zumito-framework 1.1.2 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -127,7 +127,7 @@ class ZumitoFramework {
127
127
  }
128
128
  ;
129
129
  // Create module instance
130
- let moduleInstance = new module(path.join(modulesFolder, moduleName));
130
+ let moduleInstance = new module(path.join(modulesFolder, moduleName), this);
131
131
  this.modules.set(moduleInstance.constructor.name, moduleInstance);
132
132
  // Register module commands
133
133
  this.commands = new Map([...this.commands, ...moduleInstance.getCommands()]);
@@ -20,10 +20,10 @@ class InteractionCreate extends FrameworkEvent_1.FrameworkEvent {
20
20
  if (![CommandType_1.CommandType.any, CommandType_1.CommandType.separated, CommandType_1.CommandType.slash].includes(commandInstance.type))
21
21
  return;
22
22
  if (commandInstance.type === CommandType_1.CommandType.separated || commandInstance.type === CommandType_1.CommandType.slash) {
23
- await commandInstance.executeSlashCommand({ client, interaction, args });
23
+ await commandInstance.executeSlashCommand({ client, interaction, args, framework });
24
24
  }
25
25
  else {
26
- await commandInstance.execute({ client, interaction, args });
26
+ await commandInstance.execute({ client, interaction, args, framework });
27
27
  }
28
28
  }
29
29
  else if (interaction.isButton()) {
@@ -73,6 +73,7 @@ class InteractionCreate extends FrameworkEvent_1.FrameworkEvent {
73
73
  message,
74
74
  args: parsedArgs,
75
75
  client: framework.client,
76
+ framework: framework,
76
77
  });
77
78
  if (!message.channel.isDMBased && !message.deletable && (false)) { // false = settings.deleteCommands
78
79
  try {
@@ -1,4 +1,5 @@
1
1
  import { Client, Interaction, Message } from "discord.js";
2
+ import { ZumitoFramework } from "../ZumitoFramework";
2
3
  /**
3
4
  * @class CommandParameters
4
5
  * @classdesc Parameters passed to a command execution.
@@ -12,4 +13,5 @@ export interface CommandParameters {
12
13
  interaction?: Interaction;
13
14
  args: Map<String, any>;
14
15
  client: Client;
16
+ framework: ZumitoFramework;
15
17
  }
@@ -16,8 +16,8 @@ export declare abstract class Command {
16
16
  args: CommandArgDefinition[];
17
17
  type: string;
18
18
  constructor();
19
- abstract execute({ message, interaction, args, client }: CommandParameters): void;
20
- executePrefixCommand({ message, interaction, args, client }: CommandParameters): void;
21
- executeSlashCommand({ message, interaction, args, client }: CommandParameters): void;
19
+ abstract execute({ message, interaction, args, client, framework }: CommandParameters): void;
20
+ executePrefixCommand({ message, interaction, args, client, framework }: CommandParameters): void;
21
+ executeSlashCommand({ message, interaction, args, client, framework }: CommandParameters): void;
22
22
  selectMenu({ path, interaction, client, framework }: SelectMenuParameters): void;
23
23
  }
@@ -19,11 +19,11 @@ class Command {
19
19
  type = CommandType_1.CommandType.prefix;
20
20
  constructor() {
21
21
  }
22
- executePrefixCommand({ message, interaction, args, client }) {
23
- this.execute({ message, interaction, args, client });
22
+ executePrefixCommand({ message, interaction, args, client, framework }) {
23
+ this.execute({ message, interaction, args, client, framework });
24
24
  }
25
- executeSlashCommand({ message, interaction, args, client }) {
26
- this.execute({ message, interaction, args, client });
25
+ executeSlashCommand({ message, interaction, args, client, framework }) {
26
+ this.execute({ message, interaction, args, client, framework });
27
27
  }
28
28
  selectMenu({ path, interaction, client, framework }) { }
29
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zumito-framework",
3
- "version": "1.1.2",
3
+ "version": "1.1.5",
4
4
  "description": "Discord.js bot framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -4,7 +4,7 @@ export class Test extends Command {
4
4
 
5
5
  name: 'test';
6
6
 
7
- execute({ message, interaction, args, client }: CommandParameters): void {
7
+ execute({ message, interaction, args, client, framework }: CommandParameters): void {
8
8
  message.channel.send({
9
9
  content: "Test command executed",
10
10
  });