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.
- package/dist/ZumitoFramework.js +1 -1
- package/dist/baseModule/events/discord/interactionCreate.js +2 -2
- package/dist/baseModule/events/discord/messageCreate.js +1 -0
- package/dist/types/CommandParameters.d.ts +2 -0
- package/dist/types/Commands.d.ts +3 -3
- package/dist/types/Commands.js +4 -4
- package/package.json +1 -1
- package/plop-templates/command.js.hbs +1 -1
package/dist/ZumitoFramework.js
CHANGED
|
@@ -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
|
}
|
package/dist/types/Commands.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/types/Commands.js
CHANGED
|
@@ -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
|
@@ -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
|
});
|