reciple 4.0.0 → 5.0.0-pre.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/RecipleClient.d.ts +3 -3
- package/bin/reciple/classes/RecipleClient.js +22 -21
- package/bin/reciple/classes/RecipleConfig.d.ts +1 -1
- package/bin/reciple/classes/builders/MessageCommandBuilder.d.ts +43 -19
- package/bin/reciple/classes/builders/MessageCommandBuilder.js +60 -31
- package/bin/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +6 -5
- package/bin/reciple/classes/builders/SlashCommandBuilder.d.ts +35 -11
- package/bin/reciple/classes/builders/SlashCommandBuilder.js +19 -1
- package/bin/reciple/modules.d.ts +3 -3
- package/bin/reciple/modules.js +4 -4
- package/bin/reciple/types/builders.d.ts +14 -5
- package/bin/reciple/types/commands.d.ts +22 -19
- package/bin/reciple/types/commands.js +10 -10
- package/bin/reciple/types/paramOptions.d.ts +2 -2
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MessageCommandBuilder, MessageCommandExecuteData } from './builders/MessageCommandBuilder';
|
|
2
|
-
import { ApplicationCommandBuilder } from '../registerApplicationCommands';
|
|
3
|
-
import { CommandBuilder, CommandBuilderType } from '../types/builders';
|
|
4
2
|
import { SlashCommandBuilder, SlashCommandExecuteData } from './builders/SlashCommandBuilder';
|
|
3
|
+
import { ApplicationCommandBuilder } from '../registerApplicationCommands';
|
|
4
|
+
import { AnyCommandBuilder, CommandBuilderType } from '../types/builders';
|
|
5
5
|
import { CommandCooldownManager } from './CommandCooldownManager';
|
|
6
6
|
import { RecipleClientAddModuleOptions } from '../types/paramOptions';
|
|
7
7
|
import { Logger as ILogger } from 'fallout-utility';
|
|
@@ -79,7 +79,7 @@ export declare class RecipleClient<Ready extends boolean = boolean> extends Clie
|
|
|
79
79
|
* Add slash or message command to client
|
|
80
80
|
* @param command Slash/Message command builder
|
|
81
81
|
*/
|
|
82
|
-
addCommand(command:
|
|
82
|
+
addCommand(command: AnyCommandBuilder): RecipleClient<Ready>;
|
|
83
83
|
/**
|
|
84
84
|
* Listed to command executions
|
|
85
85
|
*/
|
|
@@ -11,8 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.RecipleClient = void 0;
|
|
13
13
|
const MessageCommandBuilder_1 = require("./builders/MessageCommandBuilder");
|
|
14
|
-
const
|
|
14
|
+
const SlashCommandBuilder_1 = require("./builders/SlashCommandBuilder");
|
|
15
15
|
const registerApplicationCommands_1 = require("../registerApplicationCommands");
|
|
16
|
+
const permissions_1 = require("../permissions");
|
|
16
17
|
const builders_1 = require("../types/builders");
|
|
17
18
|
const CommandCooldownManager_1 = require("./CommandCooldownManager");
|
|
18
19
|
const MessageCommandOptionManager_1 = require("./MessageCommandOptionManager");
|
|
@@ -134,10 +135,10 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
134
135
|
*/
|
|
135
136
|
addCommand(command) {
|
|
136
137
|
var _a;
|
|
137
|
-
if (command.
|
|
138
|
+
if (command.type === builders_1.CommandBuilderType.MessageCommand) {
|
|
138
139
|
this.commands.messageCommands[command.name] = command;
|
|
139
140
|
}
|
|
140
|
-
else if (command.
|
|
141
|
+
else if (command.type === builders_1.CommandBuilderType.SlashCommand) {
|
|
141
142
|
this.commands.slashCommands[command.name] = command;
|
|
142
143
|
}
|
|
143
144
|
else if (this.isClientLogsEnabled()) {
|
|
@@ -171,7 +172,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
171
172
|
const command = this.findCommand(parseCommand.command, builders_1.CommandBuilderType.MessageCommand);
|
|
172
173
|
if (!command)
|
|
173
174
|
return;
|
|
174
|
-
const commandOptions = (0, MessageCommandBuilder_1.validateMessageCommandOptions)(command, parseCommand);
|
|
175
|
+
const commandOptions = yield (0, MessageCommandBuilder_1.validateMessageCommandOptions)(command, parseCommand);
|
|
175
176
|
const executeData = {
|
|
176
177
|
message: message,
|
|
177
178
|
options: commandOptions,
|
|
@@ -191,20 +192,20 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
191
192
|
return;
|
|
192
193
|
if (command.validateOptions) {
|
|
193
194
|
if (commandOptions.some(o => o.invalid)) {
|
|
194
|
-
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.
|
|
195
|
+
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.InvalidArguments, invalidArguments: new MessageCommandOptionManager_1.MessageCommandOptionManager(...executeData.options.filter(o => o.invalid)) }))) {
|
|
195
196
|
message.reply(this.getMessage('invalidArguments', 'Invalid argument(s) given.')).catch(er => this._replyError(er));
|
|
196
197
|
}
|
|
197
198
|
return;
|
|
198
199
|
}
|
|
199
200
|
if (commandOptions.some(o => o.missing)) {
|
|
200
|
-
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.
|
|
201
|
+
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.MissingArguments, missingArguments: new MessageCommandOptionManager_1.MessageCommandOptionManager(...executeData.options.filter(o => o.missing)) }))) {
|
|
201
202
|
message.reply(this.getMessage('missingArguments', 'Not enough arguments.')).catch(er => this._replyError(er));
|
|
202
203
|
}
|
|
203
204
|
return;
|
|
204
205
|
}
|
|
205
206
|
}
|
|
206
207
|
if (message.guild && !(0, permissions_1.botHasExecutePermissions)(message.guild, command.requiredBotPermissions)) {
|
|
207
|
-
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.
|
|
208
|
+
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.MissingBotPermissions }))) {
|
|
208
209
|
message.reply(this.getMessage('insufficientBotPerms', 'Insufficient bot permissions.')).catch(er => this._replyError(er));
|
|
209
210
|
}
|
|
210
211
|
return;
|
|
@@ -220,7 +221,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
220
221
|
this.commandCooldowns.add(Object.assign(Object.assign({}, userCooldown), { expireTime: Date.now() + command.cooldown }));
|
|
221
222
|
}
|
|
222
223
|
else if (this.config.commands.messageCommand.enableCooldown && command.cooldown) {
|
|
223
|
-
if (!(yield this._haltCommand(command, Object.assign({ executeData, reason: commands_1.
|
|
224
|
+
if (!(yield this._haltCommand(command, Object.assign({ executeData, reason: commands_1.CommandHaltReason.Cooldown }, this.commandCooldowns.get(userCooldown))))) {
|
|
224
225
|
yield message.reply(this.getMessage('cooldown', 'You cannot execute this command right now due to the cooldown.')).catch(er => this._replyError(er));
|
|
225
226
|
}
|
|
226
227
|
return;
|
|
@@ -228,16 +229,16 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
228
229
|
try {
|
|
229
230
|
yield Promise.resolve(command.execute(executeData))
|
|
230
231
|
.then(() => this.emit('recipleMessageCommandCreate', executeData))
|
|
231
|
-
.catch((err) => __awaiter(this, void 0, void 0, function* () { return (yield this._haltCommand(command, { executeData, reason: commands_1.
|
|
232
|
+
.catch((err) => __awaiter(this, void 0, void 0, function* () { return (yield this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.Error, error: err })) ? this._commandExecuteError(err, executeData) : void 0; }));
|
|
232
233
|
return executeData;
|
|
233
234
|
}
|
|
234
235
|
catch (err) {
|
|
235
|
-
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.
|
|
236
|
+
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.Error, error: err }))) {
|
|
236
237
|
this._commandExecuteError(err, executeData);
|
|
237
238
|
}
|
|
238
239
|
}
|
|
239
240
|
}
|
|
240
|
-
else if (!(yield this._haltCommand(command, { executeData, reason: commands_1.
|
|
241
|
+
else if (!(yield this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.MissingMemberPermissions }))) {
|
|
241
242
|
message.reply(this.getMessage('noPermissions', 'You do not have permission to use this command.')).catch(er => this._replyError(er));
|
|
242
243
|
}
|
|
243
244
|
});
|
|
@@ -249,7 +250,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
249
250
|
slashCommandExecute(interaction) {
|
|
250
251
|
var _a, _b;
|
|
251
252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
-
if (!interaction ||
|
|
253
|
+
if (!interaction || !interaction.isChatInputCommand() || !this.isReady())
|
|
253
254
|
return;
|
|
254
255
|
const command = this.findCommand(interaction.commandName, builders_1.CommandBuilderType.SlashCommand);
|
|
255
256
|
if (!command)
|
|
@@ -267,7 +268,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
267
268
|
if (!command || (0, permissions_1.isIgnoredChannel)(interaction.channelId, this.config.ignoredChannels))
|
|
268
269
|
return;
|
|
269
270
|
if (interaction.guild && !(0, permissions_1.botHasExecutePermissions)(interaction.guild, command.requiredBotPermissions)) {
|
|
270
|
-
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.
|
|
271
|
+
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.MissingBotPermissions }))) {
|
|
271
272
|
yield interaction.reply(this.getMessage('insufficientBotPerms', 'Insufficient bot permissions.')).catch(er => this._replyError(er));
|
|
272
273
|
}
|
|
273
274
|
return;
|
|
@@ -283,7 +284,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
283
284
|
this.commandCooldowns.add(Object.assign(Object.assign({}, userCooldown), { expireTime: Date.now() + command.cooldown }));
|
|
284
285
|
}
|
|
285
286
|
else if (this.config.commands.slashCommand.enableCooldown && command.cooldown) {
|
|
286
|
-
if (!(yield this._haltCommand(command, Object.assign({ executeData, reason: commands_1.
|
|
287
|
+
if (!(yield this._haltCommand(command, Object.assign({ executeData, reason: commands_1.CommandHaltReason.Cooldown }, this.commandCooldowns.get(userCooldown))))) {
|
|
287
288
|
yield interaction.reply(this.getMessage('cooldown', 'You cannot execute this command right now due to the cooldown.')).catch(er => this._replyError(er));
|
|
288
289
|
}
|
|
289
290
|
return;
|
|
@@ -291,16 +292,16 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
291
292
|
try {
|
|
292
293
|
yield Promise.resolve(command.execute(executeData))
|
|
293
294
|
.then(() => this.emit('recipleInteractionCommandCreate', executeData))
|
|
294
|
-
.catch((err) => __awaiter(this, void 0, void 0, function* () { return (yield this._haltCommand(command, { executeData, reason: commands_1.
|
|
295
|
+
.catch((err) => __awaiter(this, void 0, void 0, function* () { return (yield this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.Error, error: err })) ? this._commandExecuteError(err, executeData) : void 0; }));
|
|
295
296
|
return executeData;
|
|
296
297
|
}
|
|
297
298
|
catch (err) {
|
|
298
|
-
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.
|
|
299
|
+
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.Error, error: err }))) {
|
|
299
300
|
this._commandExecuteError(err, executeData);
|
|
300
301
|
}
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
|
-
else if (!(yield this._haltCommand(command, { executeData, reason: commands_1.
|
|
304
|
+
else if (!(yield this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.MissingMemberPermissions }))) {
|
|
304
305
|
yield interaction.reply(this.getMessage('noPermissions', 'You do not have permission to use this command.')).catch(er => this._replyError(er));
|
|
305
306
|
}
|
|
306
307
|
});
|
|
@@ -345,7 +346,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
345
346
|
return __awaiter(this, void 0, void 0, function* () {
|
|
346
347
|
try {
|
|
347
348
|
return (_a = (command.halt
|
|
348
|
-
? yield (command.
|
|
349
|
+
? yield (command.type == builders_1.CommandBuilderType.SlashCommand
|
|
349
350
|
? Promise.resolve(command.halt(haltData))
|
|
350
351
|
: Promise.resolve(command.halt(haltData))).catch(err => { throw err; })
|
|
351
352
|
: false)) !== null && _a !== void 0 ? _a : false;
|
|
@@ -367,17 +368,17 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
367
368
|
_commandExecuteError(err, command) {
|
|
368
369
|
return __awaiter(this, void 0, void 0, function* () {
|
|
369
370
|
if (this.isClientLogsEnabled()) {
|
|
370
|
-
this.logger.error(`An error occured executing ${command.builder.
|
|
371
|
+
this.logger.error(`An error occured executing ${command.builder.type == builders_1.CommandBuilderType.MessageCommand ? 'message' : 'slash'} command "${command.builder.name}"`);
|
|
371
372
|
this.logger.error(err);
|
|
372
373
|
}
|
|
373
374
|
if (!err || !command)
|
|
374
375
|
return;
|
|
375
|
-
if (command
|
|
376
|
+
if (MessageCommandBuilder_1.MessageCommandBuilder.isMessageCommandExecuteData(command)) {
|
|
376
377
|
if (!this.config.commands.messageCommand.replyOnError)
|
|
377
378
|
return;
|
|
378
379
|
yield command.message.reply(this.getMessage('error', 'An error occurred.')).catch(er => this._replyError(er));
|
|
379
380
|
}
|
|
380
|
-
else if (command
|
|
381
|
+
else if (SlashCommandBuilder_1.SlashCommandBuilder.isSlashCommandExecuteData(command)) {
|
|
381
382
|
if (!this.config.commands.slashCommand.replyOnError)
|
|
382
383
|
return;
|
|
383
384
|
yield command.interaction.followUp(this.getMessage('error', 'An error occurred.')).catch(er => this._replyError(er));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { CommandBuilderType, AnyCommandExecuteData, AnyCommandExecuteFunction, AnyCommandHaltFunction } from '../../types/builders';
|
|
1
2
|
import { MessageCommandOptionManager } from '../MessageCommandOptionManager';
|
|
2
3
|
import { MessageCommandOptionBuilder } from './MessageCommandOptionBuilder';
|
|
3
|
-
import { Awaitable, Message, PermissionResolvable } from 'discord.js';
|
|
4
4
|
import { Command as CommandMessage } from 'fallout-utility';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Message, PermissionResolvable } from 'discord.js';
|
|
6
|
+
import { AnyCommandHaltData } from '../../types/commands';
|
|
7
7
|
import { RecipleClient } from '../RecipleClient';
|
|
8
8
|
/**
|
|
9
9
|
* Execute data for message command
|
|
@@ -25,11 +25,23 @@ export interface MessageCommandValidatedOption {
|
|
|
25
25
|
invalid: boolean;
|
|
26
26
|
missing: boolean;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Message command halt data
|
|
30
|
+
*/
|
|
31
|
+
export declare type MessageCommandHaltData = AnyCommandHaltData<CommandBuilderType.MessageCommand>;
|
|
32
|
+
/**
|
|
33
|
+
* Message command halt function
|
|
34
|
+
*/
|
|
35
|
+
export declare type MessageCommandHaltFunction = AnyCommandHaltFunction<CommandBuilderType.MessageCommand>;
|
|
36
|
+
/**
|
|
37
|
+
* Message command execute function
|
|
38
|
+
*/
|
|
39
|
+
export declare type MessageCommandExecuteFunction = AnyCommandExecuteFunction<CommandBuilderType.MessageCommand>;
|
|
28
40
|
/**
|
|
29
41
|
* Reciple builder for message command
|
|
30
42
|
*/
|
|
31
43
|
export declare class MessageCommandBuilder {
|
|
32
|
-
readonly
|
|
44
|
+
readonly type = CommandBuilderType.MessageCommand;
|
|
33
45
|
name: string;
|
|
34
46
|
cooldown: number;
|
|
35
47
|
description: string;
|
|
@@ -40,68 +52,80 @@ export declare class MessageCommandBuilder {
|
|
|
40
52
|
requiredMemberPermissions: PermissionResolvable[];
|
|
41
53
|
allowExecuteInDM: boolean;
|
|
42
54
|
allowExecuteByBots: boolean;
|
|
43
|
-
halt?:
|
|
44
|
-
execute:
|
|
55
|
+
halt?: MessageCommandHaltFunction;
|
|
56
|
+
execute: MessageCommandExecuteFunction;
|
|
45
57
|
/**
|
|
46
58
|
* Sets the command name
|
|
47
59
|
* @param name Command name
|
|
48
60
|
*/
|
|
49
|
-
setName(name: string):
|
|
61
|
+
setName(name: string): this;
|
|
50
62
|
/**
|
|
51
63
|
* Sets the command description
|
|
52
64
|
* @param description Command description
|
|
53
65
|
*/
|
|
54
|
-
setDescription(description: string):
|
|
66
|
+
setDescription(description: string): this;
|
|
55
67
|
/**
|
|
56
68
|
* Sets the execute cooldown for this command.
|
|
57
69
|
* - `0` means no cooldown
|
|
58
70
|
* @param cooldown Command cooldown in milliseconds
|
|
59
71
|
*/
|
|
60
|
-
setCooldown(cooldown: number):
|
|
72
|
+
setCooldown(cooldown: number): this;
|
|
61
73
|
/**
|
|
62
74
|
* Add aliases to the command
|
|
63
75
|
* @param aliases Command aliases
|
|
64
76
|
*/
|
|
65
|
-
addAliases(...aliases: string[]):
|
|
77
|
+
addAliases(...aliases: string[]): this;
|
|
66
78
|
/**
|
|
67
79
|
* Set required bot permissions to execute the command
|
|
68
80
|
* @param permissions Bot's required permissions
|
|
69
81
|
*/
|
|
70
|
-
setRequiredBotPermissions(...permissions: PermissionResolvable[]):
|
|
82
|
+
setRequiredBotPermissions(...permissions: PermissionResolvable[]): this;
|
|
71
83
|
/**
|
|
72
84
|
* Set required permissions to execute the command
|
|
73
85
|
* @param permissions User's return permissions
|
|
74
86
|
*/
|
|
75
|
-
setRequiredMemberPermissions(...permissions: PermissionResolvable[]):
|
|
87
|
+
setRequiredMemberPermissions(...permissions: PermissionResolvable[]): this;
|
|
76
88
|
/**
|
|
77
89
|
* Set if command can be executed in dms
|
|
78
90
|
* @param allowExecuteInDM `true` if the command can execute in DMs
|
|
79
91
|
*/
|
|
80
|
-
setAllowExecuteInDM(allowExecuteInDM: boolean):
|
|
92
|
+
setAllowExecuteInDM(allowExecuteInDM: boolean): this;
|
|
81
93
|
/**
|
|
82
94
|
* Allow command to be executed by bots
|
|
83
95
|
* @param allowExecuteByBots `true` if the command can be executed by bots
|
|
84
96
|
*/
|
|
85
|
-
setAllowExecuteByBots(allowExecuteByBots: boolean):
|
|
97
|
+
setAllowExecuteByBots(allowExecuteByBots: boolean): this;
|
|
86
98
|
/**
|
|
87
99
|
* Function when the command is interupted
|
|
88
100
|
* @param halt Function to execute when command is halted
|
|
89
101
|
*/
|
|
90
|
-
setHalt(halt?:
|
|
102
|
+
setHalt(halt?: this["halt"]): this;
|
|
91
103
|
/**
|
|
92
104
|
* Function when the command is executed
|
|
93
105
|
* @param execute Function to execute when the command is called
|
|
94
106
|
*/
|
|
95
|
-
setExecute(execute:
|
|
107
|
+
setExecute(execute: this["execute"]): this;
|
|
96
108
|
/**
|
|
97
109
|
* Add option to the command
|
|
98
110
|
* @param option Message option builder
|
|
99
111
|
*/
|
|
100
|
-
addOption(option: MessageCommandOptionBuilder | ((constructor: MessageCommandOptionBuilder) => MessageCommandOptionBuilder)):
|
|
112
|
+
addOption(option: MessageCommandOptionBuilder | ((constructor: MessageCommandOptionBuilder) => MessageCommandOptionBuilder)): this;
|
|
101
113
|
/**
|
|
102
114
|
* Validate options before executing
|
|
103
115
|
* @param validateOptions `true` if the command options needs to be validated before executing
|
|
104
116
|
*/
|
|
105
|
-
setValidateOptions(validateOptions: boolean):
|
|
117
|
+
setValidateOptions(validateOptions: boolean): this;
|
|
118
|
+
/**
|
|
119
|
+
* True if this is a message command builder
|
|
120
|
+
*/
|
|
121
|
+
isMessageCommand(): this is MessageCommandBuilder;
|
|
122
|
+
/**
|
|
123
|
+
* Is a message command builder
|
|
124
|
+
*/
|
|
125
|
+
static isMessageCommandBuilder(builder: any): builder is MessageCommandBuilder;
|
|
126
|
+
/**
|
|
127
|
+
* Is a message command execute data
|
|
128
|
+
*/
|
|
129
|
+
static isMessageCommandExecuteData(executeData: AnyCommandExecuteData): executeData is MessageCommandExecuteData;
|
|
106
130
|
}
|
|
107
|
-
export declare function validateMessageCommandOptions(builder: MessageCommandBuilder, options: CommandMessage): MessageCommandOptionManager
|
|
131
|
+
export declare function validateMessageCommandOptions(builder: MessageCommandBuilder, options: CommandMessage): Promise<MessageCommandOptionManager>;
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.validateMessageCommandOptions = exports.MessageCommandBuilder = void 0;
|
|
13
|
+
const builders_1 = require("../../types/builders");
|
|
4
14
|
const MessageCommandOptionManager_1 = require("../MessageCommandOptionManager");
|
|
5
15
|
const MessageCommandOptionBuilder_1 = require("./MessageCommandOptionBuilder");
|
|
6
|
-
const builders_1 = require("../../types/builders");
|
|
7
16
|
/**
|
|
8
17
|
* Reciple builder for message command
|
|
9
18
|
*/
|
|
10
19
|
class MessageCommandBuilder {
|
|
11
20
|
constructor() {
|
|
12
|
-
this.
|
|
21
|
+
this.type = builders_1.CommandBuilderType.MessageCommand;
|
|
13
22
|
this.name = '';
|
|
14
23
|
this.cooldown = 0;
|
|
15
24
|
this.description = '';
|
|
@@ -144,39 +153,59 @@ class MessageCommandBuilder {
|
|
|
144
153
|
this.validateOptions = validateOptions;
|
|
145
154
|
return this;
|
|
146
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* True if this is a message command builder
|
|
158
|
+
*/
|
|
159
|
+
isMessageCommand() {
|
|
160
|
+
return this instanceof MessageCommandBuilder;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Is a message command builder
|
|
164
|
+
*/
|
|
165
|
+
static isMessageCommandBuilder(builder) {
|
|
166
|
+
return builder instanceof MessageCommandBuilder;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Is a message command execute data
|
|
170
|
+
*/
|
|
171
|
+
static isMessageCommandExecuteData(executeData) {
|
|
172
|
+
return executeData.builder !== undefined && this.isMessageCommandBuilder(executeData.builder);
|
|
173
|
+
}
|
|
147
174
|
}
|
|
148
175
|
exports.MessageCommandBuilder = MessageCommandBuilder;
|
|
149
176
|
function validateMessageCommandOptions(builder, options) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
const args = options.args || [];
|
|
179
|
+
const required = builder.options.filter(o => o.required);
|
|
180
|
+
const optional = builder.options.filter(o => !o.required);
|
|
181
|
+
const allOptions = [...required, ...optional];
|
|
182
|
+
const result = [];
|
|
183
|
+
let i = 0;
|
|
184
|
+
for (const option of allOptions) {
|
|
185
|
+
const arg = args[i];
|
|
186
|
+
const value = {
|
|
187
|
+
name: option.name,
|
|
188
|
+
value: arg !== null && arg !== void 0 ? arg : undefined,
|
|
189
|
+
required: option.required,
|
|
190
|
+
invalid: false,
|
|
191
|
+
missing: false
|
|
192
|
+
};
|
|
193
|
+
if (arg == undefined && option.required) {
|
|
194
|
+
value.missing = true;
|
|
195
|
+
result.push(value);
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (arg == undefined && !option.required) {
|
|
199
|
+
result.push(value);
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
const validate = option.validator ? yield Promise.resolve(option.validator(arg)) : true;
|
|
203
|
+
if (!validate)
|
|
204
|
+
value.invalid = true;
|
|
167
205
|
result.push(value);
|
|
168
|
-
|
|
206
|
+
i++;
|
|
169
207
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
174
|
-
const validate = option.validator ? option.validator(arg) : true;
|
|
175
|
-
if (!validate)
|
|
176
|
-
value.invalid = true;
|
|
177
|
-
result.push(value);
|
|
178
|
-
i++;
|
|
179
|
-
}
|
|
180
|
-
return new MessageCommandOptionManager_1.MessageCommandOptionManager(...result);
|
|
208
|
+
return new MessageCommandOptionManager_1.MessageCommandOptionManager(...result);
|
|
209
|
+
});
|
|
181
210
|
}
|
|
182
211
|
exports.validateMessageCommandOptions = validateMessageCommandOptions;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Awaitable } from 'discord.js';
|
|
1
2
|
/**
|
|
2
3
|
* Option builder for MessageCommandBuilder
|
|
3
4
|
*/
|
|
@@ -5,25 +6,25 @@ export declare class MessageCommandOptionBuilder {
|
|
|
5
6
|
name: string;
|
|
6
7
|
description: string;
|
|
7
8
|
required: boolean;
|
|
8
|
-
validator: (value: string) => boolean
|
|
9
|
+
validator: (value: string) => Awaitable<boolean>;
|
|
9
10
|
/**
|
|
10
11
|
* Set command option name
|
|
11
12
|
* @param name Option name
|
|
12
13
|
*/
|
|
13
|
-
setName(name: string):
|
|
14
|
+
setName(name: string): this;
|
|
14
15
|
/**
|
|
15
16
|
* Set command option description
|
|
16
17
|
* @param description Option description
|
|
17
18
|
*/
|
|
18
|
-
setDescription(description: string):
|
|
19
|
+
setDescription(description: string): this;
|
|
19
20
|
/**
|
|
20
21
|
* Set if this option is required
|
|
21
22
|
* @param required `true` if this option is required
|
|
22
23
|
*/
|
|
23
|
-
setRequired(required: boolean):
|
|
24
|
+
setRequired(required: boolean): this;
|
|
24
25
|
/**
|
|
25
26
|
* Set your custom function to validate given value for this option
|
|
26
27
|
* @param validator Custom function to validate value given for this option
|
|
27
28
|
*/
|
|
28
|
-
setValidator(validator: (value: string) => boolean):
|
|
29
|
+
setValidator(validator: (value: string) => Awaitable<boolean>): this;
|
|
29
30
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CommandBuilderType } from '../../types/builders';
|
|
2
|
-
import {
|
|
1
|
+
import { CommandBuilderType, AnyCommandExecuteData, AnyCommandExecuteFunction, AnyCommandHaltFunction } from '../../types/builders';
|
|
2
|
+
import { AnyCommandHaltData } from '../../types/commands';
|
|
3
3
|
import { RecipleClient } from '../RecipleClient';
|
|
4
|
-
import {
|
|
4
|
+
import { ChatInputCommandInteraction, PermissionResolvable, SlashCommandBuilder as DiscordJsSlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder as DiscordJsSlashCommandSubcommandsOnlyBuilder } from 'discord.js';
|
|
5
5
|
/**
|
|
6
6
|
* Execute data for interaction command
|
|
7
7
|
*/
|
|
@@ -16,41 +16,65 @@ export interface SlashCommandBuilder extends DiscordJsSlashCommandBuilder {
|
|
|
16
16
|
addSubcommandGroup(input: SlashCommandSubcommandGroupBuilder | ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
|
17
17
|
addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Slash command halt data
|
|
21
|
+
*/
|
|
22
|
+
export declare type SlashCommandHaltData = AnyCommandHaltData<CommandBuilderType.SlashCommand>;
|
|
23
|
+
/**
|
|
24
|
+
* Slash command halt function
|
|
25
|
+
*/
|
|
26
|
+
export declare type SlashCommandHaltFunction = AnyCommandHaltFunction<CommandBuilderType.SlashCommand>;
|
|
27
|
+
/**
|
|
28
|
+
* Slash command execute function
|
|
29
|
+
*/
|
|
30
|
+
export declare type SlashCommandExecuteFunction = AnyCommandExecuteFunction<CommandBuilderType.SlashCommand>;
|
|
19
31
|
/**
|
|
20
32
|
* Reciple builder for interaction/slash command
|
|
21
33
|
*/
|
|
22
34
|
export declare class SlashCommandBuilder extends DiscordJsSlashCommandBuilder {
|
|
23
|
-
readonly
|
|
35
|
+
readonly type = CommandBuilderType.SlashCommand;
|
|
24
36
|
cooldown: number;
|
|
25
37
|
requiredBotPermissions: PermissionResolvable[];
|
|
26
38
|
requiredMemberPermissions: PermissionResolvable[];
|
|
27
39
|
allowExecuteInDM: boolean;
|
|
28
|
-
halt?:
|
|
29
|
-
execute:
|
|
40
|
+
halt?: SlashCommandHaltFunction;
|
|
41
|
+
execute: SlashCommandExecuteFunction;
|
|
30
42
|
/**
|
|
31
43
|
* Sets the execute cooldown for this command.
|
|
32
44
|
* - `0` means no cooldown
|
|
33
45
|
* @param cooldown Command cooldown in milliseconds
|
|
34
46
|
*/
|
|
35
|
-
setCooldown(cooldown: number):
|
|
47
|
+
setCooldown(cooldown: number): this;
|
|
36
48
|
/**
|
|
37
49
|
* Set required bot permissions to execute the command
|
|
38
50
|
* @param permissions Bot's required permissions
|
|
39
51
|
*/
|
|
40
|
-
setRequiredBotPermissions(...permissions: PermissionResolvable[]):
|
|
52
|
+
setRequiredBotPermissions(...permissions: PermissionResolvable[]): this;
|
|
41
53
|
/**
|
|
42
54
|
* Set required permissions to execute the command
|
|
43
55
|
* @param permissions User's return permissions
|
|
44
56
|
*/
|
|
45
|
-
setRequiredMemberPermissions(...permissions: PermissionResolvable[]):
|
|
57
|
+
setRequiredMemberPermissions(...permissions: PermissionResolvable[]): this;
|
|
46
58
|
/**
|
|
47
59
|
* Function when the command is interupted
|
|
48
60
|
* @param halt Function to execute when command is halted
|
|
49
61
|
*/
|
|
50
|
-
setHalt(halt?:
|
|
62
|
+
setHalt(halt?: this["halt"]): this;
|
|
51
63
|
/**
|
|
52
64
|
* Function when the command is executed
|
|
53
65
|
* @param execute Function to execute when the command is called
|
|
54
66
|
*/
|
|
55
|
-
setExecute(execute:
|
|
67
|
+
setExecute(execute: this["execute"]): this;
|
|
68
|
+
/**
|
|
69
|
+
* True if this is a slash command builder
|
|
70
|
+
*/
|
|
71
|
+
isSlashCommand(): this is SlashCommandBuilder;
|
|
72
|
+
/**
|
|
73
|
+
* Is a slash command builder
|
|
74
|
+
*/
|
|
75
|
+
static isSlashCommandBuilder(builder: any): builder is SlashCommandBuilder;
|
|
76
|
+
/**
|
|
77
|
+
* Is a slash command execute data
|
|
78
|
+
*/
|
|
79
|
+
static isSlashCommandExecuteData(executeData: AnyCommandExecuteData): executeData is SlashCommandExecuteData;
|
|
56
80
|
}
|
|
@@ -9,7 +9,7 @@ const discord_js_1 = require("discord.js");
|
|
|
9
9
|
class SlashCommandBuilder extends discord_js_1.SlashCommandBuilder {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
|
-
this.
|
|
12
|
+
this.type = builders_1.CommandBuilderType.SlashCommand;
|
|
13
13
|
this.cooldown = 0;
|
|
14
14
|
this.requiredBotPermissions = [];
|
|
15
15
|
this.requiredMemberPermissions = [];
|
|
@@ -59,5 +59,23 @@ class SlashCommandBuilder extends discord_js_1.SlashCommandBuilder {
|
|
|
59
59
|
this.execute = execute;
|
|
60
60
|
return this;
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* True if this is a slash command builder
|
|
64
|
+
*/
|
|
65
|
+
isSlashCommand() {
|
|
66
|
+
return this instanceof SlashCommandBuilder;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Is a slash command builder
|
|
70
|
+
*/
|
|
71
|
+
static isSlashCommandBuilder(builder) {
|
|
72
|
+
return builder instanceof SlashCommandBuilder;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Is a slash command execute data
|
|
76
|
+
*/
|
|
77
|
+
static isSlashCommandExecuteData(executeData) {
|
|
78
|
+
return executeData.builder !== undefined && this.isSlashCommandBuilder(executeData.builder);
|
|
79
|
+
}
|
|
62
80
|
}
|
|
63
81
|
exports.SlashCommandBuilder = SlashCommandBuilder;
|
package/bin/reciple/modules.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyCommandBuilder } from './types/builders';
|
|
2
2
|
import { RecipleClient } from './classes/RecipleClient';
|
|
3
3
|
export declare type LoadedModules = {
|
|
4
|
-
commands:
|
|
4
|
+
commands: AnyCommandBuilder[];
|
|
5
5
|
modules: RecipleModule[];
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
@@ -9,7 +9,7 @@ export declare type LoadedModules = {
|
|
|
9
9
|
*/
|
|
10
10
|
export interface RecipleScript {
|
|
11
11
|
versions: string | string[];
|
|
12
|
-
commands?:
|
|
12
|
+
commands?: AnyCommandBuilder[];
|
|
13
13
|
onLoad?(reciple: RecipleClient): void | Promise<void>;
|
|
14
14
|
onStart(reciple: RecipleClient): boolean | Promise<boolean>;
|
|
15
15
|
}
|
package/bin/reciple/modules.js
CHANGED
|
@@ -50,7 +50,7 @@ function loadModules(client, folder) {
|
|
|
50
50
|
throw new Error(script + ' onStart is not defined or returned false.');
|
|
51
51
|
if (module_.commands) {
|
|
52
52
|
for (const command of module_.commands) {
|
|
53
|
-
if (command.
|
|
53
|
+
if (command.type === builders_1.CommandBuilderType.MessageCommand || command.type === builders_1.CommandBuilderType.SlashCommand) {
|
|
54
54
|
commands.push(command);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -66,12 +66,12 @@ function loadModules(client, folder) {
|
|
|
66
66
|
response.commands.push(...commands.filter((c) => {
|
|
67
67
|
if (!c.name) {
|
|
68
68
|
if (client.isClientLogsEnabled())
|
|
69
|
-
client.logger.error(`A ${c.
|
|
69
|
+
client.logger.error(`A ${builders_1.CommandBuilderType[c.type]} command name is not defined in ${script}`);
|
|
70
70
|
return false;
|
|
71
71
|
}
|
|
72
|
-
if (c.
|
|
72
|
+
if (c.type === builders_1.CommandBuilderType.MessageCommand && c.options.length && c.options.some(o => !o.name)) {
|
|
73
73
|
if (client.isClientLogsEnabled())
|
|
74
|
-
client.logger.error(`A ${c.
|
|
74
|
+
client.logger.error(`A ${builders_1.CommandBuilderType[c.type]} option name is not defined in ${script}`);
|
|
75
75
|
return false;
|
|
76
76
|
}
|
|
77
77
|
return true;
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import { MessageCommandBuilder, MessageCommandExecuteData } from '../classes/builders/MessageCommandBuilder';
|
|
2
|
-
import { SlashCommandBuilder, SlashCommandExecuteData } from '../classes/builders/SlashCommandBuilder';
|
|
1
|
+
import { MessageCommandBuilder, MessageCommandExecuteData, MessageCommandHaltData } from '../classes/builders/MessageCommandBuilder';
|
|
2
|
+
import { SlashCommandBuilder, SlashCommandExecuteData, SlashCommandHaltData } from '../classes/builders/SlashCommandBuilder';
|
|
3
|
+
import { Awaitable } from 'discord.js';
|
|
3
4
|
/**
|
|
4
5
|
* Reciple command builders
|
|
5
6
|
*/
|
|
6
|
-
export declare type
|
|
7
|
+
export declare type AnyCommandBuilder = MessageCommandBuilder | SlashCommandBuilder;
|
|
7
8
|
/**
|
|
8
|
-
* Reciple command
|
|
9
|
+
* Reciple command execute data
|
|
9
10
|
*/
|
|
10
|
-
export declare type
|
|
11
|
+
export declare type AnyCommandExecuteData = SlashCommandExecuteData | MessageCommandExecuteData;
|
|
12
|
+
/**
|
|
13
|
+
* Reciple command halt function
|
|
14
|
+
*/
|
|
15
|
+
export declare type AnyCommandHaltFunction<T extends CommandBuilderType> = (haltData: T extends CommandBuilderType.SlashCommand ? SlashCommandHaltData : MessageCommandHaltData) => Awaitable<boolean | null | undefined | void>;
|
|
16
|
+
/**
|
|
17
|
+
* Reciple command execute function
|
|
18
|
+
*/
|
|
19
|
+
export declare type AnyCommandExecuteFunction<T extends CommandBuilderType> = (executeData: T extends CommandBuilderType.SlashCommand ? SlashCommandExecuteData : MessageCommandExecuteData) => Awaitable<void>;
|
|
11
20
|
/**
|
|
12
21
|
* Types of Reciple command builders
|
|
13
22
|
*/
|
|
@@ -1,40 +1,43 @@
|
|
|
1
1
|
import { MessageCommandExecuteData } from '../classes/builders/MessageCommandBuilder';
|
|
2
|
-
import { SlashCommandBuilder, SlashCommandExecuteData } from '../classes/builders/SlashCommandBuilder';
|
|
3
2
|
import { MessageCommandOptionManager } from '../classes/MessageCommandOptionManager';
|
|
3
|
+
import { SlashCommandExecuteData } from '../classes/builders/SlashCommandBuilder';
|
|
4
|
+
import { CommandBuilderType, AnyCommandExecuteData } from '../types/builders';
|
|
4
5
|
import { CooledDownUser } from '../classes/CommandCooldownManager';
|
|
5
|
-
import { CommandBuilder } from '../types/builders';
|
|
6
6
|
/**
|
|
7
|
-
* Halted command's data
|
|
7
|
+
* Any Halted command's data
|
|
8
8
|
*/
|
|
9
|
-
export declare type
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
export declare type AnyCommandHaltData<T extends CommandBuilderType = CommandBuilderType> = CommandErrorData<T> | CommandCooldownData<T> | (T extends CommandBuilderType.SlashCommand ? never : CommandInvalidArguments<T> | CommandMissingArguments<T>) | CommandMissingMemberPermissions<T> | CommandMissingBotPermissions<T>;
|
|
10
|
+
/**
|
|
11
|
+
* Command halt reason base interface
|
|
12
|
+
*/
|
|
13
|
+
export interface CommandHaltReasonBase<T extends CommandBuilderType> {
|
|
14
|
+
executeData: T extends CommandBuilderType.SlashCommand ? SlashCommandExecuteData : T extends CommandBuilderType.MessageCommand ? MessageCommandExecuteData : AnyCommandExecuteData;
|
|
12
15
|
}
|
|
13
|
-
export interface CommandErrorData<
|
|
14
|
-
reason:
|
|
16
|
+
export interface CommandErrorData<T extends CommandBuilderType> extends CommandHaltReasonBase<T> {
|
|
17
|
+
reason: CommandHaltReason.Error;
|
|
15
18
|
error: any;
|
|
16
19
|
}
|
|
17
|
-
export interface CommandCooldownData<
|
|
18
|
-
reason:
|
|
20
|
+
export interface CommandCooldownData<T extends CommandBuilderType> extends CommandHaltReasonBase<T>, CooledDownUser {
|
|
21
|
+
reason: CommandHaltReason.Cooldown;
|
|
19
22
|
}
|
|
20
|
-
export interface CommandInvalidArguments<
|
|
21
|
-
reason:
|
|
23
|
+
export interface CommandInvalidArguments<T extends CommandBuilderType> extends CommandHaltReasonBase<T> {
|
|
24
|
+
reason: CommandHaltReason.InvalidArguments;
|
|
22
25
|
invalidArguments: MessageCommandOptionManager;
|
|
23
26
|
}
|
|
24
|
-
export interface CommandMissingArguments<
|
|
25
|
-
reason:
|
|
27
|
+
export interface CommandMissingArguments<T extends CommandBuilderType> extends CommandHaltReasonBase<T> {
|
|
28
|
+
reason: CommandHaltReason.MissingArguments;
|
|
26
29
|
missingArguments: MessageCommandOptionManager;
|
|
27
30
|
}
|
|
28
|
-
export interface CommandMissingMemberPermissions<
|
|
29
|
-
reason:
|
|
31
|
+
export interface CommandMissingMemberPermissions<T extends CommandBuilderType> extends CommandHaltReasonBase<T> {
|
|
32
|
+
reason: CommandHaltReason.MissingMemberPermissions;
|
|
30
33
|
}
|
|
31
|
-
export interface CommandMissingBotPermissions<
|
|
32
|
-
reason:
|
|
34
|
+
export interface CommandMissingBotPermissions<T extends CommandBuilderType> extends CommandHaltReasonBase<T> {
|
|
35
|
+
reason: CommandHaltReason.MissingBotPermissions;
|
|
33
36
|
}
|
|
34
37
|
/**
|
|
35
38
|
* Command halt reasons
|
|
36
39
|
*/
|
|
37
|
-
export declare enum
|
|
40
|
+
export declare enum CommandHaltReason {
|
|
38
41
|
Error = 0,
|
|
39
42
|
Cooldown = 1,
|
|
40
43
|
InvalidArguments = 2,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CommandHaltReason = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Command halt reasons
|
|
6
6
|
*/
|
|
7
|
-
var
|
|
8
|
-
(function (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
})(
|
|
7
|
+
var CommandHaltReason;
|
|
8
|
+
(function (CommandHaltReason) {
|
|
9
|
+
CommandHaltReason[CommandHaltReason["Error"] = 0] = "Error";
|
|
10
|
+
CommandHaltReason[CommandHaltReason["Cooldown"] = 1] = "Cooldown";
|
|
11
|
+
CommandHaltReason[CommandHaltReason["InvalidArguments"] = 2] = "InvalidArguments";
|
|
12
|
+
CommandHaltReason[CommandHaltReason["MissingArguments"] = 3] = "MissingArguments";
|
|
13
|
+
CommandHaltReason[CommandHaltReason["MissingMemberPermissions"] = 4] = "MissingMemberPermissions";
|
|
14
|
+
CommandHaltReason[CommandHaltReason["MissingBotPermissions"] = 5] = "MissingBotPermissions";
|
|
15
|
+
})(CommandHaltReason = exports.CommandHaltReason || (exports.CommandHaltReason = {}));
|
|
@@ -3,7 +3,7 @@ import { ApplicationCommandData, PermissionsBitField } from 'discord.js';
|
|
|
3
3
|
import { RecipleModule, RecipleScript } from '../modules';
|
|
4
4
|
import { RecipleClient } from '../classes/RecipleClient';
|
|
5
5
|
import { Config } from '../classes/RecipleConfig';
|
|
6
|
-
import {
|
|
6
|
+
import { AnyCommandBuilder } from './builders';
|
|
7
7
|
export interface RecipleClientAddModuleOptions {
|
|
8
8
|
/**
|
|
9
9
|
* The Module script
|
|
@@ -33,7 +33,7 @@ export interface RegisterApplicationCommandsOptions {
|
|
|
33
33
|
guilds?: string | string[];
|
|
34
34
|
}
|
|
35
35
|
export interface UserHasCommandPermissionsOptions {
|
|
36
|
-
builder:
|
|
36
|
+
builder: AnyCommandBuilder;
|
|
37
37
|
memberPermissions?: PermissionsBitField;
|
|
38
38
|
commandPermissions?: Config["commands"]["slashCommand"]["permissions"] | Config["commands"]["messageCommand"]["permissions"];
|
|
39
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reciple",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-pre.1",
|
|
4
4
|
"bin": "bin/bin.js",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "bin/index.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/node": "^18.6.1",
|
|
60
60
|
"@types/semver": "^7.3.10",
|
|
61
|
-
"discord.js": "^14.
|
|
61
|
+
"discord.js": "^14.1.2",
|
|
62
62
|
"rimraf": "^3.0.2",
|
|
63
63
|
"typedoc": "^0.23.9",
|
|
64
64
|
"typedoc-plugin-discord-types": "^1.0.2",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"typescript": "^4.7.4"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"discord.js": "^14.
|
|
70
|
+
"discord.js": "^14.1.2"
|
|
71
71
|
},
|
|
72
72
|
"packageManager": "yarn@3.2.2"
|
|
73
73
|
}
|