reciple 1.0.0 → 1.0.1
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/bin/reciple/classes/Client.js +2 -4
- package/bin/reciple/classes/builders/InteractionCommandBuilder.d.ts +1 -0
- package/bin/reciple/classes/builders/InteractionCommandBuilder.js +1 -0
- package/bin/reciple/classes/builders/MessageCommandBuilder.d.ts +1 -0
- package/bin/reciple/classes/builders/MessageCommandBuilder.js +1 -0
- package/bin/reciple/modules.js +3 -6
- package/package.json +1 -1
|
@@ -12,8 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.RecipleClient = void 0;
|
|
13
13
|
const discord_js_1 = require("discord.js");
|
|
14
14
|
const fallout_utility_1 = require("fallout-utility");
|
|
15
|
-
const MessageCommandBuilder_1 = require("./builders/MessageCommandBuilder");
|
|
16
|
-
const InteractionCommandBuilder_1 = require("./builders/InteractionCommandBuilder");
|
|
17
15
|
const registerInteractionCommands_1 = require("../registerInteractionCommands");
|
|
18
16
|
const logger_1 = require("../logger");
|
|
19
17
|
const modules_1 = require("../modules");
|
|
@@ -43,10 +41,10 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
43
41
|
for (const command of modules.commands) {
|
|
44
42
|
if (!command.name)
|
|
45
43
|
continue;
|
|
46
|
-
if (command
|
|
44
|
+
if (command.type === 'MESSAGE_COMMAND') {
|
|
47
45
|
this.commands.MESSAGE_COMMANDS[command.name] = command;
|
|
48
46
|
}
|
|
49
|
-
else if (command
|
|
47
|
+
else if (command.type === 'INTERACTION_COMMAND') {
|
|
50
48
|
this.commands.INTERACTION_COMMANDS[command.name] = command;
|
|
51
49
|
}
|
|
52
50
|
}
|
|
@@ -8,6 +8,7 @@ export interface RecipleInteractionCommandExecute {
|
|
|
8
8
|
client: RecipleClient;
|
|
9
9
|
}
|
|
10
10
|
export declare class InteractionCommandBuilder extends SlashCommandBuilder {
|
|
11
|
+
readonly type: string;
|
|
11
12
|
allowExecuteInDM: boolean;
|
|
12
13
|
execute: (options: RecipleInteractionCommandExecute) => void;
|
|
13
14
|
setAllowExecuteInDM(allowExecuteInDM: boolean): InteractionCommandBuilder;
|
|
@@ -5,6 +5,7 @@ const builders_1 = require("@discordjs/builders");
|
|
|
5
5
|
class InteractionCommandBuilder extends builders_1.SlashCommandBuilder {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
|
+
this.type = 'INTERACTION_COMMAND';
|
|
8
9
|
this.allowExecuteInDM = true;
|
|
9
10
|
this.execute = (options) => { };
|
|
10
11
|
}
|
package/bin/reciple/modules.js
CHANGED
|
@@ -15,7 +15,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.loadModules = void 0;
|
|
16
16
|
const fs_1 = require("fs");
|
|
17
17
|
const MessageCommandBuilder_1 = require("./classes/builders/MessageCommandBuilder");
|
|
18
|
-
const InteractionCommandBuilder_1 = require("./classes/builders/InteractionCommandBuilder");
|
|
19
18
|
const path_1 = __importDefault(require("path"));
|
|
20
19
|
function loadModules(client) {
|
|
21
20
|
var _a;
|
|
@@ -38,10 +37,8 @@ function loadModules(client) {
|
|
|
38
37
|
throw new Error(script + ' onStart is not defined or returned false.');
|
|
39
38
|
if (module_.commands) {
|
|
40
39
|
for (const command of module_.commands) {
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
commands.push(command);
|
|
40
|
+
if (command.type === 'MESSAGE_COMMAND' || command.type === 'INTERACTION_COMMAND')
|
|
41
|
+
commands.push(command);
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
44
|
}
|
|
@@ -55,7 +52,7 @@ function loadModules(client) {
|
|
|
55
52
|
logger.error(`A message command name is not defined in ${script}`);
|
|
56
53
|
return false;
|
|
57
54
|
}
|
|
58
|
-
if (c instanceof MessageCommandBuilder_1.MessageCommandBuilder && c.options.some(o => !o.name)) {
|
|
55
|
+
if (c instanceof MessageCommandBuilder_1.MessageCommandBuilder && c.options.length && c.options.some(o => !o.name)) {
|
|
59
56
|
logger.error(`A message command option name is not defined in ${script}`);
|
|
60
57
|
return false;
|
|
61
58
|
}
|