zumito-framework 1.1.4 → 1.1.7
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.d.ts +4 -4
- 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/dist/types/Module.d.ts +7 -7
- package/dist/types/Translation.d.ts +3 -3
- package/package.json +1 -1
- package/plop-templates/command.js.hbs +1 -1
|
@@ -15,10 +15,10 @@ import { FrameworkEvent } from "./types/FrameworkEvent";
|
|
|
15
15
|
export declare class ZumitoFramework {
|
|
16
16
|
client: any;
|
|
17
17
|
settings: FrameworkSettings;
|
|
18
|
-
modules: Map<
|
|
19
|
-
commands: Map<
|
|
20
|
-
events: Map<
|
|
21
|
-
translations: Map<
|
|
18
|
+
modules: Map<string, Module>;
|
|
19
|
+
commands: Map<string, Command>;
|
|
20
|
+
events: Map<string, FrameworkEvent>;
|
|
21
|
+
translations: Map<string, string>;
|
|
22
22
|
routes: any;
|
|
23
23
|
models: any;
|
|
24
24
|
database: any;
|
|
@@ -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/dist/types/Module.d.ts
CHANGED
|
@@ -4,16 +4,16 @@ import { FrameworkEvent } from "./FrameworkEvent";
|
|
|
4
4
|
export declare abstract class Module {
|
|
5
5
|
protected path: string;
|
|
6
6
|
protected framework: ZumitoFramework;
|
|
7
|
-
protected commands: Map<
|
|
8
|
-
protected events: Map<
|
|
9
|
-
protected translations: Map<
|
|
7
|
+
protected commands: Map<string, Command>;
|
|
8
|
+
protected events: Map<string, FrameworkEvent>;
|
|
9
|
+
protected translations: Map<string, string>;
|
|
10
10
|
constructor(path: any, framework: any);
|
|
11
11
|
registerCommands(): void;
|
|
12
|
-
getCommands(): Map<
|
|
12
|
+
getCommands(): Map<string, Command>;
|
|
13
13
|
registerEvents(): void;
|
|
14
14
|
registerEvent(frameworkEvent: FrameworkEvent): void;
|
|
15
|
-
getEvents(): Map<
|
|
15
|
+
getEvents(): Map<string, FrameworkEvent>;
|
|
16
16
|
registerTranslations(): void;
|
|
17
|
-
getTranslations(): Map<
|
|
18
|
-
parseTranslation(path:
|
|
17
|
+
getTranslations(): Map<string, string>;
|
|
18
|
+
parseTranslation(path: string, json: any): any;
|
|
19
19
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare class Translation {
|
|
2
|
-
text: Map<
|
|
2
|
+
text: Map<string, string>;
|
|
3
3
|
constructor();
|
|
4
4
|
get(language: string): String;
|
|
5
5
|
set(language: string, text: string): void;
|
|
6
6
|
has(language: string): boolean;
|
|
7
|
-
getAll(): Map<
|
|
8
|
-
setAll(text: Map<
|
|
7
|
+
getAll(): Map<string, string>;
|
|
8
|
+
setAll(text: Map<string, string>): void;
|
|
9
9
|
}
|
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
|
});
|