reciple 3.1.2 → 4.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/README.md +7 -2
- package/bin/index.d.ts +1 -1
- package/bin/index.js +1 -1
- package/bin/reciple/classes/RecipleClient.d.ts +15 -12
- package/bin/reciple/classes/RecipleClient.js +35 -32
- package/bin/reciple/classes/RecipleConfig.d.ts +2 -1
- package/bin/reciple/classes/builders/SlashCommandBuilder.d.ts +56 -0
- package/bin/reciple/classes/builders/{InteractionCommandBuilder.js → SlashCommandBuilder.js} +5 -5
- package/bin/reciple/modules.js +2 -2
- package/bin/reciple/registerInteractionCommands.d.ts +7 -7
- package/bin/reciple/registerInteractionCommands.js +18 -17
- package/bin/reciple/types/builders.d.ts +4 -4
- package/bin/reciple/types/builders.js +1 -1
- package/bin/reciple/types/commands.d.ts +3 -3
- package/bin/reciple/types/paramOptions.d.ts +5 -5
- package/package.json +10 -6
- package/resource/reciple.yml +4 -1
- package/bin/reciple/classes/builders/InteractionCommandBuilder.d.ts +0 -51
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
</h1>
|
|
5
5
|
|
|
6
6
|
<h3 align="center">
|
|
7
|
-
<a href="https://npmjs.org/package/reciple">
|
|
7
|
+
<a href="https://npmjs.org/package/reciple">
|
|
8
8
|
<img src="https://img.shields.io/npm/v/reciple?label=latest%20npm%20release%20">
|
|
9
9
|
</a>
|
|
10
10
|
<a href="https://github.com/FalloutStudios/Reciple/blob/main/LICENSE">
|
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
<img src="https://www.codefactor.io/repository/github/falloutstudios/reciple/badge/main">
|
|
15
15
|
</a>
|
|
16
16
|
|
|
17
|
-
A simple Dicord.js handler that just works
|
|
17
|
+
A simple Dicord.js handler that just works.
|
|
18
|
+
</h3>
|
|
18
19
|
|
|
19
20
|
****
|
|
20
21
|
|
|
21
22
|
## Installation
|
|
23
|
+
|
|
22
24
|
To install the bot, run the following command in your terminal:
|
|
23
25
|
|
|
24
26
|
```bash
|
|
@@ -58,6 +60,9 @@ You can override the given token using your terminal
|
|
|
58
60
|
```bash
|
|
59
61
|
npx reciple --token "YOUR_TOKEN_HERE"
|
|
60
62
|
```
|
|
63
|
+
|
|
64
|
+
Use env variable
|
|
65
|
+
|
|
61
66
|
```bash
|
|
62
67
|
npx reciple --token "env:TOKEN_VARIABLE"
|
|
63
68
|
```
|
package/bin/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export * from './reciple/classes/CommandCooldownManager';
|
|
|
2
2
|
export * from './reciple/classes/MessageCommandOptionManager';
|
|
3
3
|
export * from './reciple/classes/RecipleClient';
|
|
4
4
|
export * from './reciple/classes/RecipleConfig';
|
|
5
|
-
export * from './reciple/classes/builders/
|
|
5
|
+
export * from './reciple/classes/builders/SlashCommandBuilder';
|
|
6
6
|
export * from './reciple/classes/builders/MessageCommandBuilder';
|
|
7
7
|
export * from './reciple/classes/builders/MessageCommandOptionBuilder';
|
|
8
8
|
export * from './reciple/types/builders';
|
package/bin/index.js
CHANGED
|
@@ -18,7 +18,7 @@ __exportStar(require("./reciple/classes/CommandCooldownManager"), exports);
|
|
|
18
18
|
__exportStar(require("./reciple/classes/MessageCommandOptionManager"), exports);
|
|
19
19
|
__exportStar(require("./reciple/classes/RecipleClient"), exports);
|
|
20
20
|
__exportStar(require("./reciple/classes/RecipleConfig"), exports);
|
|
21
|
-
__exportStar(require("./reciple/classes/builders/
|
|
21
|
+
__exportStar(require("./reciple/classes/builders/SlashCommandBuilder"), exports);
|
|
22
22
|
__exportStar(require("./reciple/classes/builders/MessageCommandBuilder"), exports);
|
|
23
23
|
__exportStar(require("./reciple/classes/builders/MessageCommandOptionBuilder"), exports);
|
|
24
24
|
__exportStar(require("./reciple/types/builders"), exports);
|
|
@@ -2,8 +2,8 @@ import { RecipleModule } from '../modules';
|
|
|
2
2
|
import { ApplicationCommandBuilder } from '../registerInteractionCommands';
|
|
3
3
|
import { RecipleCommandBuilder, RecipleCommandBuilderType } from '../types/builders';
|
|
4
4
|
import { RecipleAddModuleOptions } from '../types/paramOptions';
|
|
5
|
-
import { InteractionCommandBuilder, InteractionCommandExecuteData } from './builders/InteractionCommandBuilder';
|
|
6
5
|
import { MessageCommandBuilder, MessageCommandExecuteData } from './builders/MessageCommandBuilder';
|
|
6
|
+
import { SlashCommandBuilder, SlashCommandExecuteData } from './builders/SlashCommandBuilder';
|
|
7
7
|
import { CommandCooldownManager } from './CommandCooldownManager';
|
|
8
8
|
import { Config } from './RecipleConfig';
|
|
9
9
|
import { ApplicationCommandData, Awaitable, ChatInputCommandInteraction, Client, ClientEvents, ClientOptions, Interaction, Message } from 'discord.js';
|
|
@@ -21,8 +21,8 @@ export interface RecipleClientCommands {
|
|
|
21
21
|
messageCommands: {
|
|
22
22
|
[commandName: string]: MessageCommandBuilder;
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
[commandName: string]:
|
|
24
|
+
slashCommands: {
|
|
25
|
+
[commandName: string]: SlashCommandBuilder;
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
@@ -30,7 +30,7 @@ export interface RecipleClientCommands {
|
|
|
30
30
|
*/
|
|
31
31
|
export interface RecipleClientEvents extends ClientEvents {
|
|
32
32
|
recipleMessageCommandCreate: [executeData: MessageCommandExecuteData];
|
|
33
|
-
recipleInteractionCommandCreate: [executeData:
|
|
33
|
+
recipleInteractionCommandCreate: [executeData: SlashCommandExecuteData];
|
|
34
34
|
recipleReplyError: [error: unknown];
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
@@ -49,6 +49,9 @@ export interface RecipleClient<Ready extends boolean = boolean> extends Client<R
|
|
|
49
49
|
removeAllListeners(event?: string | symbol): this;
|
|
50
50
|
isReady(): this is RecipleClient<true>;
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* The reciple client
|
|
54
|
+
*/
|
|
52
55
|
export declare class RecipleClient<Ready extends boolean = boolean> extends Client<Ready> {
|
|
53
56
|
config: Config;
|
|
54
57
|
commands: RecipleClientCommands;
|
|
@@ -67,7 +70,7 @@ export declare class RecipleClient<Ready extends boolean = boolean> extends Clie
|
|
|
67
70
|
*/
|
|
68
71
|
startModules(folder?: string): Promise<RecipleClient<Ready>>;
|
|
69
72
|
/**
|
|
70
|
-
* Execute `onLoad()` from client modules and register
|
|
73
|
+
* Execute `onLoad()` from client modules and register application commands if enabled
|
|
71
74
|
*/
|
|
72
75
|
loadModules(): Promise<RecipleClient<Ready>>;
|
|
73
76
|
/**
|
|
@@ -76,8 +79,8 @@ export declare class RecipleClient<Ready extends boolean = boolean> extends Clie
|
|
|
76
79
|
*/
|
|
77
80
|
addModule(options: RecipleAddModuleOptions): Promise<void>;
|
|
78
81
|
/**
|
|
79
|
-
* Add
|
|
80
|
-
* @param command
|
|
82
|
+
* Add slash or message command to client
|
|
83
|
+
* @param command Slash/Message command builder
|
|
81
84
|
*/
|
|
82
85
|
addCommand(command: RecipleCommandBuilder): RecipleClient<Ready>;
|
|
83
86
|
/**
|
|
@@ -91,10 +94,10 @@ export declare class RecipleClient<Ready extends boolean = boolean> extends Clie
|
|
|
91
94
|
*/
|
|
92
95
|
messageCommandExecute(message: Message, prefix?: string): Promise<void | MessageCommandExecuteData>;
|
|
93
96
|
/**
|
|
94
|
-
* Execute
|
|
95
|
-
* @param interaction
|
|
97
|
+
* Execute a slash command
|
|
98
|
+
* @param interaction Slash command interaction
|
|
96
99
|
*/
|
|
97
|
-
|
|
100
|
+
slashCommandExecute(interaction: Interaction | ChatInputCommandInteraction): Promise<void | SlashCommandExecuteData>;
|
|
98
101
|
/**
|
|
99
102
|
* Get a message from config
|
|
100
103
|
* @param messageKey Config messages key
|
|
@@ -107,7 +110,7 @@ export declare class RecipleClient<Ready extends boolean = boolean> extends Clie
|
|
|
107
110
|
* @param type Command type
|
|
108
111
|
*/
|
|
109
112
|
findCommand(command: string, type: RecipleCommandBuilderType.MessageCommand): MessageCommandBuilder | undefined;
|
|
110
|
-
findCommand(command: string, type: RecipleCommandBuilderType.
|
|
113
|
+
findCommand(command: string, type: RecipleCommandBuilderType.SlashCommand): SlashCommandBuilder | undefined;
|
|
111
114
|
/**
|
|
112
115
|
* Returns true if client logs is enabled
|
|
113
116
|
*/
|
|
@@ -126,7 +129,7 @@ export declare class RecipleClient<Ready extends boolean = boolean> extends Clie
|
|
|
126
129
|
/**
|
|
127
130
|
* Error message when a command fails to execute
|
|
128
131
|
* @param err Received error
|
|
129
|
-
* @param command
|
|
132
|
+
* @param command Slash/Message command execute data
|
|
130
133
|
*/
|
|
131
134
|
private _commandExecuteError;
|
|
132
135
|
}
|
|
@@ -24,6 +24,9 @@ const MessageCommandOptionManager_1 = require("./MessageCommandOptionManager");
|
|
|
24
24
|
const RecipleConfig_1 = require("./RecipleConfig");
|
|
25
25
|
const discord_js_1 = require("discord.js");
|
|
26
26
|
const fallout_utility_1 = require("fallout-utility");
|
|
27
|
+
/**
|
|
28
|
+
* The reciple client
|
|
29
|
+
*/
|
|
27
30
|
class RecipleClient extends discord_js_1.Client {
|
|
28
31
|
/**
|
|
29
32
|
* @param options Client options
|
|
@@ -32,7 +35,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
32
35
|
var _a, _b, _c;
|
|
33
36
|
super(options);
|
|
34
37
|
this.config = RecipleConfig_1.RecipleConfig.getDefaultConfig();
|
|
35
|
-
this.commands = { messageCommands: {},
|
|
38
|
+
this.commands = { messageCommands: {}, slashCommands: {} };
|
|
36
39
|
this.otherApplicationCommandData = [];
|
|
37
40
|
this.commandCooldowns = new CommandCooldownManager_1.CommandCooldownManager();
|
|
38
41
|
this.modules = [];
|
|
@@ -60,7 +63,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
60
63
|
});
|
|
61
64
|
}
|
|
62
65
|
/**
|
|
63
|
-
* Execute `onLoad()` from client modules and register
|
|
66
|
+
* Execute `onLoad()` from client modules and register application commands if enabled
|
|
64
67
|
*/
|
|
65
68
|
loadModules() {
|
|
66
69
|
var _a, _b;
|
|
@@ -86,13 +89,13 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
86
89
|
if (this.isClientLogsEnabled()) {
|
|
87
90
|
this.logger.info(`${this.modules.length} modules loaded.`);
|
|
88
91
|
this.logger.info(`${Object.keys(this.commands.messageCommands).length} message commands loaded.`);
|
|
89
|
-
this.logger.info(`${Object.keys(this.commands.
|
|
92
|
+
this.logger.info(`${Object.keys(this.commands.slashCommands).length} slash commands loaded.`);
|
|
90
93
|
}
|
|
91
|
-
if (this.config.commands.
|
|
92
|
-
yield (0, registerInteractionCommands_1.
|
|
94
|
+
if (this.config.commands.slashCommand.registerCommands) {
|
|
95
|
+
yield (0, registerInteractionCommands_1.registerApplicationCommands)({
|
|
93
96
|
client: this,
|
|
94
|
-
commands: [...Object.values(this.commands.
|
|
95
|
-
guilds: this.config.commands.
|
|
97
|
+
commands: [...Object.values(this.commands.slashCommands), ...this.otherApplicationCommandData],
|
|
98
|
+
guilds: this.config.commands.slashCommand.guilds
|
|
96
99
|
});
|
|
97
100
|
}
|
|
98
101
|
return this;
|
|
@@ -106,7 +109,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
106
109
|
var _a;
|
|
107
110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
111
|
const { script } = options;
|
|
109
|
-
const registerCommands = options.
|
|
112
|
+
const registerCommands = options.registerApplicationCommands;
|
|
110
113
|
const info = options.moduleInfo;
|
|
111
114
|
this.modules.push({
|
|
112
115
|
script,
|
|
@@ -122,24 +125,24 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
122
125
|
this.addCommand(command);
|
|
123
126
|
}
|
|
124
127
|
if (registerCommands)
|
|
125
|
-
yield (0, registerInteractionCommands_1.
|
|
128
|
+
yield (0, registerInteractionCommands_1.registerApplicationCommands)({
|
|
126
129
|
client: this,
|
|
127
|
-
commands: [...Object.values(this.commands.
|
|
128
|
-
guilds: this.config.commands.
|
|
130
|
+
commands: [...Object.values(this.commands.slashCommands), ...this.otherApplicationCommandData],
|
|
131
|
+
guilds: this.config.commands.slashCommand.guilds
|
|
129
132
|
});
|
|
130
133
|
});
|
|
131
134
|
}
|
|
132
135
|
/**
|
|
133
|
-
* Add
|
|
134
|
-
* @param command
|
|
136
|
+
* Add slash or message command to client
|
|
137
|
+
* @param command Slash/Message command builder
|
|
135
138
|
*/
|
|
136
139
|
addCommand(command) {
|
|
137
140
|
var _a;
|
|
138
141
|
if (command.builder === builders_1.RecipleCommandBuilderType.MessageCommand) {
|
|
139
142
|
this.commands.messageCommands[command.name] = command;
|
|
140
143
|
}
|
|
141
|
-
else if (command.builder === builders_1.RecipleCommandBuilderType.
|
|
142
|
-
this.commands.
|
|
144
|
+
else if (command.builder === builders_1.RecipleCommandBuilderType.SlashCommand) {
|
|
145
|
+
this.commands.slashCommands[command.name] = command;
|
|
143
146
|
}
|
|
144
147
|
else if (this.isClientLogsEnabled()) {
|
|
145
148
|
this.logger.error(`Unknow command "${(_a = typeof command) !== null && _a !== void 0 ? _a : 'unknown'}".`);
|
|
@@ -152,8 +155,8 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
152
155
|
addCommandListeners() {
|
|
153
156
|
if (this.config.commands.messageCommand.enabled)
|
|
154
157
|
this.on('messageCreate', (message) => { this.messageCommandExecute(message); });
|
|
155
|
-
if (this.config.commands.
|
|
156
|
-
this.on('interactionCreate', (interaction) => { this.
|
|
158
|
+
if (this.config.commands.slashCommand.enabled)
|
|
159
|
+
this.on('interactionCreate', (interaction) => { this.slashCommandExecute(interaction); });
|
|
157
160
|
return this;
|
|
158
161
|
}
|
|
159
162
|
/**
|
|
@@ -244,26 +247,26 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
244
247
|
});
|
|
245
248
|
}
|
|
246
249
|
/**
|
|
247
|
-
* Execute
|
|
248
|
-
* @param interaction
|
|
250
|
+
* Execute a slash command
|
|
251
|
+
* @param interaction Slash command interaction
|
|
249
252
|
*/
|
|
250
|
-
|
|
253
|
+
slashCommandExecute(interaction) {
|
|
251
254
|
var _a, _b;
|
|
252
255
|
return __awaiter(this, void 0, void 0, function* () {
|
|
253
256
|
if (!interaction || interaction.type !== discord_js_1.InteractionType.ApplicationCommand || !interaction.isChatInputCommand() || !this.isReady())
|
|
254
257
|
return;
|
|
255
|
-
const command = this.findCommand(interaction.commandName, builders_1.RecipleCommandBuilderType.
|
|
258
|
+
const command = this.findCommand(interaction.commandName, builders_1.RecipleCommandBuilderType.SlashCommand);
|
|
256
259
|
if (!command)
|
|
257
260
|
return;
|
|
258
261
|
const executeData = {
|
|
259
|
-
interaction
|
|
262
|
+
interaction,
|
|
260
263
|
builder: command,
|
|
261
264
|
client: this
|
|
262
265
|
};
|
|
263
266
|
if ((0, permissions_1.userHasCommandPermissions)({
|
|
264
267
|
builder: command,
|
|
265
268
|
memberPermissions: (_a = interaction.memberPermissions) !== null && _a !== void 0 ? _a : undefined,
|
|
266
|
-
commandPermissions: this.config.commands.
|
|
269
|
+
commandPermissions: this.config.commands.slashCommand.permissions
|
|
267
270
|
})) {
|
|
268
271
|
if (!command || (0, permissions_1.isIgnoredChannel)(interaction.channelId, this.config.ignoredChannels))
|
|
269
272
|
return;
|
|
@@ -278,12 +281,12 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
278
281
|
command: command.name,
|
|
279
282
|
channel: (_b = interaction.channel) !== null && _b !== void 0 ? _b : undefined,
|
|
280
283
|
guild: interaction.guild,
|
|
281
|
-
type: builders_1.RecipleCommandBuilderType.
|
|
284
|
+
type: builders_1.RecipleCommandBuilderType.SlashCommand
|
|
282
285
|
};
|
|
283
|
-
if (this.config.commands.
|
|
286
|
+
if (this.config.commands.slashCommand.enableCooldown && command.cooldown && !this.commandCooldowns.isCooledDown(userCooldown)) {
|
|
284
287
|
this.commandCooldowns.add(Object.assign(Object.assign({}, userCooldown), { expireTime: Date.now() + command.cooldown }));
|
|
285
288
|
}
|
|
286
|
-
else if (this.config.commands.
|
|
289
|
+
else if (this.config.commands.slashCommand.enableCooldown && command.cooldown) {
|
|
287
290
|
if (!(yield this._haltCommand(command, Object.assign({ executeData, reason: commands_1.RecipleHaltedCommandReason.Cooldown }, this.commandCooldowns.get(userCooldown))))) {
|
|
288
291
|
yield interaction.reply(this.getMessage('cooldown', 'You cannot execute this command right now due to the cooldown.')).catch(er => this._replyError(er));
|
|
289
292
|
}
|
|
@@ -318,8 +321,8 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
318
321
|
findCommand(command, type) {
|
|
319
322
|
var _a;
|
|
320
323
|
switch (type) {
|
|
321
|
-
case builders_1.RecipleCommandBuilderType.
|
|
322
|
-
return this.commands.
|
|
324
|
+
case builders_1.RecipleCommandBuilderType.SlashCommand:
|
|
325
|
+
return this.commands.slashCommands[command];
|
|
323
326
|
case builders_1.RecipleCommandBuilderType.MessageCommand:
|
|
324
327
|
return (_a = this.commands.messageCommands[command.toLowerCase()]) !== null && _a !== void 0 ? _a : (this.config.commands.messageCommand.allowCommandAlias
|
|
325
328
|
? Object.values(this.commands.messageCommands).find(c => c.aliases.some(a => a == (command === null || command === void 0 ? void 0 : command.toLowerCase())))
|
|
@@ -346,7 +349,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
346
349
|
return __awaiter(this, void 0, void 0, function* () {
|
|
347
350
|
try {
|
|
348
351
|
return (_a = (command.halt
|
|
349
|
-
? yield (command.builder == builders_1.RecipleCommandBuilderType.
|
|
352
|
+
? yield (command.builder == builders_1.RecipleCommandBuilderType.SlashCommand
|
|
350
353
|
? Promise.resolve(command.halt(haltData))
|
|
351
354
|
: Promise.resolve(command.halt(haltData))).catch(err => { throw err; })
|
|
352
355
|
: false)) !== null && _a !== void 0 ? _a : false;
|
|
@@ -363,12 +366,12 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
363
366
|
/**
|
|
364
367
|
* Error message when a command fails to execute
|
|
365
368
|
* @param err Received error
|
|
366
|
-
* @param command
|
|
369
|
+
* @param command Slash/Message command execute data
|
|
367
370
|
*/
|
|
368
371
|
_commandExecuteError(err, command) {
|
|
369
372
|
return __awaiter(this, void 0, void 0, function* () {
|
|
370
373
|
if (this.isClientLogsEnabled()) {
|
|
371
|
-
this.logger.error(`An error occured executing ${command.builder.builder == builders_1.RecipleCommandBuilderType.MessageCommand ? 'message' : '
|
|
374
|
+
this.logger.error(`An error occured executing ${command.builder.builder == builders_1.RecipleCommandBuilderType.MessageCommand ? 'message' : 'slash'} command "${command.builder.name}"`);
|
|
372
375
|
this.logger.error(err);
|
|
373
376
|
}
|
|
374
377
|
if (!err || !command)
|
|
@@ -379,7 +382,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
379
382
|
yield command.message.reply(this.getMessage('error', 'An error occurred.')).catch(er => this._replyError(er));
|
|
380
383
|
}
|
|
381
384
|
else if (command === null || command === void 0 ? void 0 : command.interaction) {
|
|
382
|
-
if (!this.config.commands.
|
|
385
|
+
if (!this.config.commands.slashCommand.replyOnError)
|
|
383
386
|
return;
|
|
384
387
|
yield command.interaction.followUp(this.getMessage('error', 'An error occurred.')).catch(er => this._replyError(er));
|
|
385
388
|
}
|
|
@@ -24,7 +24,7 @@ export interface Config {
|
|
|
24
24
|
commands: ConfigCommandPermissions[];
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
slashCommand: {
|
|
28
28
|
enabled: boolean;
|
|
29
29
|
replyOnError: boolean;
|
|
30
30
|
registerCommands: boolean;
|
|
@@ -55,6 +55,7 @@ export interface Config {
|
|
|
55
55
|
};
|
|
56
56
|
ignoredFiles: string[];
|
|
57
57
|
modulesFolder: string;
|
|
58
|
+
disableVersionCheck: boolean;
|
|
58
59
|
version: string;
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { RecipleCommandBuilderType } from '../../types/builders';
|
|
2
|
+
import { RecipleHaltedCommandData } from '../../types/commands';
|
|
3
|
+
import { RecipleClient } from '../RecipleClient';
|
|
4
|
+
import { Awaitable, ChatInputCommandInteraction, PermissionResolvable, SlashCommandBuilder as DiscordJsSlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder as DiscordJsSlashCommandSubcommandsOnlyBuilder } from 'discord.js';
|
|
5
|
+
/**
|
|
6
|
+
* Execute data for interaction command
|
|
7
|
+
*/
|
|
8
|
+
export interface SlashCommandExecuteData {
|
|
9
|
+
interaction: ChatInputCommandInteraction;
|
|
10
|
+
builder: SlashCommandBuilder;
|
|
11
|
+
client: RecipleClient<true>;
|
|
12
|
+
}
|
|
13
|
+
export interface SlashCommandSubcommandsOnlyBuilder extends DiscordJsSlashCommandSubcommandsOnlyBuilder, Pick<SlashCommandBuilder, "setCooldown" | "setRequiredBotPermissions" | "setRequiredMemberPermissions" | "setHalt" | "setExecute"> {
|
|
14
|
+
}
|
|
15
|
+
export interface SlashCommandBuilder extends DiscordJsSlashCommandBuilder {
|
|
16
|
+
addSubcommandGroup(input: SlashCommandSubcommandGroupBuilder | ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
|
17
|
+
addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Reciple builder for interaction/slash command
|
|
21
|
+
*/
|
|
22
|
+
export declare class SlashCommandBuilder extends DiscordJsSlashCommandBuilder {
|
|
23
|
+
readonly builder = RecipleCommandBuilderType.SlashCommand;
|
|
24
|
+
cooldown: number;
|
|
25
|
+
requiredBotPermissions: PermissionResolvable[];
|
|
26
|
+
requiredMemberPermissions: PermissionResolvable[];
|
|
27
|
+
allowExecuteInDM: boolean;
|
|
28
|
+
halt?: (haltData: RecipleHaltedCommandData<SlashCommandBuilder>) => Awaitable<boolean | void>;
|
|
29
|
+
execute: (executeData: SlashCommandExecuteData) => Awaitable<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Sets the execute cooldown for this command.
|
|
32
|
+
* - `0` means no cooldown
|
|
33
|
+
* @param cooldown Command cooldown in milliseconds
|
|
34
|
+
*/
|
|
35
|
+
setCooldown(cooldown: number): SlashCommandBuilder;
|
|
36
|
+
/**
|
|
37
|
+
* Set required bot permissions to execute the command
|
|
38
|
+
* @param permissions Bot's required permissions
|
|
39
|
+
*/
|
|
40
|
+
setRequiredBotPermissions(...permissions: PermissionResolvable[]): SlashCommandBuilder;
|
|
41
|
+
/**
|
|
42
|
+
* Set required permissions to execute the command
|
|
43
|
+
* @param permissions User's return permissions
|
|
44
|
+
*/
|
|
45
|
+
setRequiredMemberPermissions(...permissions: PermissionResolvable[]): SlashCommandBuilder;
|
|
46
|
+
/**
|
|
47
|
+
* Function when the command is interupted
|
|
48
|
+
* @param halt Function to execute when command is halted
|
|
49
|
+
*/
|
|
50
|
+
setHalt(halt?: (haltData: RecipleHaltedCommandData<SlashCommandBuilder>) => Awaitable<boolean | void>): SlashCommandBuilder;
|
|
51
|
+
/**
|
|
52
|
+
* Function when the command is executed
|
|
53
|
+
* @param execute Function to execute when the command is called
|
|
54
|
+
*/
|
|
55
|
+
setExecute(execute: (executeData: SlashCommandExecuteData) => void): SlashCommandBuilder;
|
|
56
|
+
}
|
package/bin/reciple/classes/builders/{InteractionCommandBuilder.js → SlashCommandBuilder.js}
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SlashCommandBuilder = void 0;
|
|
4
4
|
const builders_1 = require("../../types/builders");
|
|
5
|
-
const
|
|
5
|
+
const discord_js_1 = require("discord.js");
|
|
6
6
|
/**
|
|
7
7
|
* Reciple builder for interaction/slash command
|
|
8
8
|
*/
|
|
9
|
-
class
|
|
9
|
+
class SlashCommandBuilder extends discord_js_1.SlashCommandBuilder {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
|
-
this.builder = builders_1.RecipleCommandBuilderType.
|
|
12
|
+
this.builder = builders_1.RecipleCommandBuilderType.SlashCommand;
|
|
13
13
|
this.cooldown = 0;
|
|
14
14
|
this.requiredBotPermissions = [];
|
|
15
15
|
this.requiredMemberPermissions = [];
|
|
@@ -60,4 +60,4 @@ class InteractionCommandBuilder extends builders_2.SlashCommandBuilder {
|
|
|
60
60
|
return this;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
exports.
|
|
63
|
+
exports.SlashCommandBuilder = SlashCommandBuilder;
|
package/bin/reciple/modules.js
CHANGED
|
@@ -44,13 +44,13 @@ function loadModules(client, folder) {
|
|
|
44
44
|
if (!((_a = module_.versions) === null || _a === void 0 ? void 0 : _a.length))
|
|
45
45
|
throw new Error('Module does not have supported versions.');
|
|
46
46
|
const versions = typeof module_.versions === 'object' ? module_.versions : [module_.versions];
|
|
47
|
-
if (!versions.some(v => (0, version_1.isSupportedVersion)(v, version_1.version)))
|
|
47
|
+
if (!client.config.disableVersionCheck && !versions.some(v => (0, version_1.isSupportedVersion)(v, version_1.version)))
|
|
48
48
|
throw new Error((_b = 'Module versions is not defined or unsupported; supported versions: ' + module_.versions) !== null && _b !== void 0 ? _b : 'none' + '; current version: ' + version_1.version);
|
|
49
49
|
if (!(yield Promise.resolve(module_.onStart(client))))
|
|
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.builder === builders_1.RecipleCommandBuilderType.MessageCommand || command.builder === builders_1.RecipleCommandBuilderType.
|
|
53
|
+
if (command.builder === builders_1.RecipleCommandBuilderType.MessageCommand || command.builder === builders_1.RecipleCommandBuilderType.SlashCommand) {
|
|
54
54
|
commands.push(command);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ContextMenuCommandBuilder, SlashCommandBuilder } from '
|
|
4
|
-
export declare type ApplicationCommandBuilder =
|
|
1
|
+
import { SlashCommandBuilder } from './classes/builders/SlashCommandBuilder';
|
|
2
|
+
import { RecipleRegisterApplicationCommandsOptions } from './types/paramOptions';
|
|
3
|
+
import { ContextMenuCommandBuilder, SlashCommandBuilder as DiscordJsSlashCommandBuilder } from 'discord.js';
|
|
4
|
+
export declare type ApplicationCommandBuilder = SlashCommandBuilder | ContextMenuCommandBuilder | DiscordJsSlashCommandBuilder;
|
|
5
5
|
/**
|
|
6
|
-
* Register
|
|
7
|
-
* @param options Register
|
|
6
|
+
* Register application commands
|
|
7
|
+
* @param options Register application commands options
|
|
8
8
|
*/
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function registerApplicationCommands(options: RecipleRegisterApplicationCommandsOptions): Promise<void>;
|
|
@@ -9,31 +9,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const
|
|
12
|
+
exports.registerApplicationCommands = void 0;
|
|
13
|
+
const SlashCommandBuilder_1 = require("./classes/builders/SlashCommandBuilder");
|
|
14
14
|
/**
|
|
15
|
-
* Register
|
|
16
|
-
* @param options Register
|
|
15
|
+
* Register application commands
|
|
16
|
+
* @param options Register application commands options
|
|
17
17
|
*/
|
|
18
|
-
function
|
|
18
|
+
function registerApplicationCommands(options) {
|
|
19
19
|
var _a, _b, _c, _d;
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
21
|
const client = options.client;
|
|
22
22
|
const guilds = typeof options.guilds == 'string' ? [options.guilds] : options.guilds;
|
|
23
|
-
const commands = (_b = Object.values((_a = options.commands) !== null && _a !== void 0 ? _a : client.commands.
|
|
23
|
+
const commands = (_b = Object.values((_a = options.commands) !== null && _a !== void 0 ? _a : client.commands.slashCommands).map(cmd => {
|
|
24
24
|
var _a;
|
|
25
25
|
if (typeof (cmd === null || cmd === void 0 ? void 0 : cmd.toJSON) == 'undefined')
|
|
26
26
|
return cmd;
|
|
27
27
|
cmd = cmd;
|
|
28
|
-
if (cmd instanceof
|
|
29
|
-
const permissions = client.config.commands.
|
|
30
|
-
? (_a = client.config.commands.
|
|
28
|
+
if (cmd instanceof SlashCommandBuilder_1.SlashCommandBuilder && client.config.commands.slashCommand.setRequiredPermissions) {
|
|
29
|
+
const permissions = client.config.commands.slashCommand.permissions.enabled
|
|
30
|
+
? (_a = client.config.commands.slashCommand.permissions.commands.find(cmd_ => cmd_.command.toLowerCase() === cmd.name.toLowerCase())) === null || _a === void 0 ? void 0 : _a.permissions
|
|
31
31
|
: undefined;
|
|
32
|
-
if (permissions)
|
|
32
|
+
if (permissions) {
|
|
33
33
|
cmd.setRequiredMemberPermissions(...permissions);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
if (client.isClientLogsEnabled())
|
|
35
|
+
client.logger.debug(`Set required permissions for ${cmd.name}`);
|
|
36
|
+
}
|
|
37
|
+
client.commands.slashCommands[cmd.name] = cmd;
|
|
37
38
|
return cmd.toJSON();
|
|
38
39
|
}
|
|
39
40
|
return cmd.toJSON();
|
|
@@ -43,21 +44,21 @@ function registerInteractionCommands(options) {
|
|
|
43
44
|
if (!guilds || !(guilds === null || guilds === void 0 ? void 0 : guilds.length)) {
|
|
44
45
|
(_c = client.application) === null || _c === void 0 ? void 0 : _c.commands.set(commands).then(() => {
|
|
45
46
|
if (client.isClientLogsEnabled())
|
|
46
|
-
client.logger.warn('No guilds were specified for
|
|
47
|
+
client.logger.warn('No guilds were specified for application commands. Registered application commands globally.');
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
else {
|
|
50
51
|
if (client.isClientLogsEnabled())
|
|
51
|
-
client.logger.warn(`Registering ${commands.length}
|
|
52
|
+
client.logger.warn(`Registering ${commands.length} application commands to ${guilds.length} guild(s).`);
|
|
52
53
|
for (const guild of guilds) {
|
|
53
54
|
if (!guild)
|
|
54
55
|
continue;
|
|
55
56
|
(_d = client.application) === null || _d === void 0 ? void 0 : _d.commands.set(commands, guild).then(() => {
|
|
56
57
|
if (client.isClientLogsEnabled())
|
|
57
|
-
client.logger.warn(`Registered ${commands.length}
|
|
58
|
+
client.logger.warn(`Registered ${commands.length} application command(s) for ${guild}.`);
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
|
-
exports.
|
|
64
|
+
exports.registerApplicationCommands = registerApplicationCommands;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { InteractionCommandBuilder, InteractionCommandExecuteData } from '../classes/builders/InteractionCommandBuilder';
|
|
2
1
|
import { MessageCommandBuilder, MessageCommandExecuteData } from '../classes/builders/MessageCommandBuilder';
|
|
2
|
+
import { SlashCommandBuilder, SlashCommandExecuteData } from '../classes/builders/SlashCommandBuilder';
|
|
3
3
|
/**
|
|
4
4
|
* Reciple command builders
|
|
5
5
|
*/
|
|
6
|
-
export declare type RecipleCommandBuilder = MessageCommandBuilder |
|
|
6
|
+
export declare type RecipleCommandBuilder = MessageCommandBuilder | SlashCommandBuilder;
|
|
7
7
|
/**
|
|
8
8
|
* Reciple command builders execute data
|
|
9
9
|
*/
|
|
10
|
-
export declare type RecipleCommandBuildersExecuteData =
|
|
10
|
+
export declare type RecipleCommandBuildersExecuteData = SlashCommandExecuteData | MessageCommandExecuteData;
|
|
11
11
|
/**
|
|
12
12
|
* Types of Reciple command builders
|
|
13
13
|
*/
|
|
14
14
|
export declare enum RecipleCommandBuilderType {
|
|
15
15
|
MessageCommand = 0,
|
|
16
|
-
|
|
16
|
+
SlashCommand = 1
|
|
17
17
|
}
|
|
@@ -7,5 +7,5 @@ exports.RecipleCommandBuilderType = void 0;
|
|
|
7
7
|
var RecipleCommandBuilderType;
|
|
8
8
|
(function (RecipleCommandBuilderType) {
|
|
9
9
|
RecipleCommandBuilderType[RecipleCommandBuilderType["MessageCommand"] = 0] = "MessageCommand";
|
|
10
|
-
RecipleCommandBuilderType[RecipleCommandBuilderType["
|
|
10
|
+
RecipleCommandBuilderType[RecipleCommandBuilderType["SlashCommand"] = 1] = "SlashCommand";
|
|
11
11
|
})(RecipleCommandBuilderType = exports.RecipleCommandBuilderType || (exports.RecipleCommandBuilderType = {}));
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { InteractionCommandBuilder, InteractionCommandExecuteData } from '../classes/builders/InteractionCommandBuilder';
|
|
2
1
|
import { MessageCommandExecuteData } from '../classes/builders/MessageCommandBuilder';
|
|
2
|
+
import { SlashCommandBuilder, SlashCommandExecuteData } from '../classes/builders/SlashCommandBuilder';
|
|
3
3
|
import { CooledDownUser } from '../classes/CommandCooldownManager';
|
|
4
4
|
import { MessageCommandOptionManager } from '../classes/MessageCommandOptionManager';
|
|
5
5
|
import { RecipleCommandBuilder } from '../types/builders';
|
|
6
6
|
/**
|
|
7
7
|
* Halted command's data
|
|
8
8
|
*/
|
|
9
|
-
export declare type RecipleHaltedCommandData<Builder extends RecipleCommandBuilder = RecipleCommandBuilder> = RecipleCommandErrorData<Builder> | RecipleCommandCooldownData<Builder> | (Builder extends
|
|
9
|
+
export declare type RecipleHaltedCommandData<Builder extends RecipleCommandBuilder = RecipleCommandBuilder> = RecipleCommandErrorData<Builder> | RecipleCommandCooldownData<Builder> | (Builder extends SlashCommandBuilder ? never : RecipleCommandInvalidArguments<Builder> | RecipleCommandMissingArguments<Builder>) | RecipleCommandMissingMemberPermissions<Builder> | RecipleCommandMissingBotPermissions<Builder>;
|
|
10
10
|
export interface RecipleCommandHaltBaseData<Builder extends RecipleCommandBuilder> {
|
|
11
|
-
executeData: Builder extends
|
|
11
|
+
executeData: Builder extends SlashCommandBuilder ? SlashCommandExecuteData : MessageCommandExecuteData;
|
|
12
12
|
}
|
|
13
13
|
export interface RecipleCommandErrorData<Builder extends RecipleCommandBuilder> extends RecipleCommandHaltBaseData<Builder> {
|
|
14
14
|
reason: RecipleHaltedCommandReason.Error;
|
|
@@ -10,15 +10,15 @@ export interface RecipleAddModuleOptions {
|
|
|
10
10
|
*/
|
|
11
11
|
script: RecipleScript;
|
|
12
12
|
/**
|
|
13
|
-
* Register
|
|
13
|
+
* Register application commands if possible
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
registerApplicationCommands?: boolean;
|
|
16
16
|
/**
|
|
17
17
|
* Module optional info
|
|
18
18
|
*/
|
|
19
19
|
moduleInfo?: RecipleModule["info"];
|
|
20
20
|
}
|
|
21
|
-
export interface
|
|
21
|
+
export interface RecipleRegisterApplicationCommandsOptions {
|
|
22
22
|
/**
|
|
23
23
|
* Bot client
|
|
24
24
|
*/
|
|
@@ -27,7 +27,7 @@ export interface RecipleRegisterInteractionCommandsOptions {
|
|
|
27
27
|
* Commands to register
|
|
28
28
|
*/
|
|
29
29
|
commands: (ApplicationCommandData | ApplicationCommandBuilder)[];
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
31
|
* Set guild to not register commands globally
|
|
32
32
|
*/
|
|
33
33
|
guilds?: string | string[];
|
|
@@ -35,5 +35,5 @@ export interface RecipleRegisterInteractionCommandsOptions {
|
|
|
35
35
|
export interface RecipleUserHasCommandPermissionsOptions {
|
|
36
36
|
builder: RecipleCommandBuilder;
|
|
37
37
|
memberPermissions?: PermissionsBitField;
|
|
38
|
-
commandPermissions?: Config["commands"]["
|
|
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": "4.0.0-pre.1",
|
|
4
4
|
"bin": "bin/bin.js",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "bin/index.js",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"clean": "rm -rf bin",
|
|
23
23
|
"build": "yarn clean && yarn exec tsc",
|
|
24
24
|
"build:publish": "yarn build && yarn npm publish && yarn build:docs && yarn publish:docs",
|
|
25
|
-
"build:pub-prerelease": "yarn build && yarn publish --tag pre",
|
|
26
|
-
"build:docs": "yarn
|
|
25
|
+
"build:pub-prerelease": "yarn build && yarn npm publish --tag pre",
|
|
26
|
+
"build:docs": "yarn exec typedoc --tsconfig ./docs/typedoc.json",
|
|
27
27
|
"update:docs": "yarn workspace docs update",
|
|
28
28
|
"test": "yarn build && yarn test:start",
|
|
29
29
|
"test:start": "cd test && yarn exec reciple -D",
|
|
@@ -50,19 +50,23 @@
|
|
|
50
50
|
"chalk": "4.1.2",
|
|
51
51
|
"commander": "^9.4.0",
|
|
52
52
|
"dotenv": "^16.0.1",
|
|
53
|
-
"fallout-utility": "^1.4.
|
|
53
|
+
"fallout-utility": "^1.4.6",
|
|
54
54
|
"semver": "^7.3.7",
|
|
55
55
|
"wildcard-match": "^5.1.2",
|
|
56
56
|
"yaml": "^2.1.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/node": "^18.
|
|
59
|
+
"@types/node": "^18.6.1",
|
|
60
60
|
"@types/semver": "^7.3.10",
|
|
61
61
|
"discord.js": "^14.0.3",
|
|
62
|
+
"typedoc": "^0.23.9",
|
|
63
|
+
"typedoc-plugin-discord-types": "^1.0.2",
|
|
64
|
+
"typedoc-plugin-djs-links": "^1.2.0",
|
|
65
|
+
"typedoc-plugin-mdn-links": "^2.0.0",
|
|
62
66
|
"typescript": "^4.7.4"
|
|
63
67
|
},
|
|
64
68
|
"peerDependencies": {
|
|
65
|
-
"discord.js": "14.0.
|
|
69
|
+
"discord.js": "^14.0.3"
|
|
66
70
|
},
|
|
67
71
|
"packageManager": "yarn@3.2.2"
|
|
68
72
|
}
|
package/resource/reciple.yml
CHANGED
|
@@ -27,7 +27,7 @@ commands:
|
|
|
27
27
|
permissions: ['Administrator']
|
|
28
28
|
|
|
29
29
|
# Interaction command options
|
|
30
|
-
|
|
30
|
+
slashCommand:
|
|
31
31
|
# enable interaction commands
|
|
32
32
|
enabled: true
|
|
33
33
|
# reply when an error occured
|
|
@@ -116,5 +116,8 @@ ignoredFiles: []
|
|
|
116
116
|
# Modules folder
|
|
117
117
|
modulesFolder: 'modules'
|
|
118
118
|
|
|
119
|
+
# Load modules regardless of its supported versions
|
|
120
|
+
disableVersionCheck: false
|
|
121
|
+
|
|
119
122
|
# Current version
|
|
120
123
|
version: ^VERSION
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { RecipleCommandBuilderType } from '../../types/builders';
|
|
2
|
-
import { RecipleHaltedCommandData } from '../../types/commands';
|
|
3
|
-
import { RecipleClient } from '../RecipleClient';
|
|
4
|
-
import { SlashCommandBuilder } from '@discordjs/builders';
|
|
5
|
-
import { Awaitable, ChatInputCommandInteraction, PermissionResolvable } from 'discord.js';
|
|
6
|
-
/**
|
|
7
|
-
* Execute data for interaction command
|
|
8
|
-
*/
|
|
9
|
-
export interface InteractionCommandExecuteData {
|
|
10
|
-
interaction: ChatInputCommandInteraction;
|
|
11
|
-
builder: InteractionCommandBuilder;
|
|
12
|
-
client: RecipleClient<true>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Reciple builder for interaction/slash command
|
|
16
|
-
*/
|
|
17
|
-
export declare class InteractionCommandBuilder extends SlashCommandBuilder {
|
|
18
|
-
readonly builder = RecipleCommandBuilderType.InteractionCommand;
|
|
19
|
-
cooldown: number;
|
|
20
|
-
requiredBotPermissions: PermissionResolvable[];
|
|
21
|
-
requiredMemberPermissions: PermissionResolvable[];
|
|
22
|
-
allowExecuteInDM: boolean;
|
|
23
|
-
halt?: (haltData: RecipleHaltedCommandData<InteractionCommandBuilder>) => Awaitable<boolean | void>;
|
|
24
|
-
execute: (executeData: InteractionCommandExecuteData) => Awaitable<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Sets the execute cooldown for this command.
|
|
27
|
-
* - `0` means no cooldown
|
|
28
|
-
* @param cooldown Command cooldown in milliseconds
|
|
29
|
-
*/
|
|
30
|
-
setCooldown(cooldown: number): InteractionCommandBuilder;
|
|
31
|
-
/**
|
|
32
|
-
* Set required bot permissions to execute the command
|
|
33
|
-
* @param permissions Bot's required permissions
|
|
34
|
-
*/
|
|
35
|
-
setRequiredBotPermissions(...permissions: PermissionResolvable[]): InteractionCommandBuilder;
|
|
36
|
-
/**
|
|
37
|
-
* Set required permissions to execute the command
|
|
38
|
-
* @param permissions User's return permissions
|
|
39
|
-
*/
|
|
40
|
-
setRequiredMemberPermissions(...permissions: PermissionResolvable[]): InteractionCommandBuilder;
|
|
41
|
-
/**
|
|
42
|
-
* Function when the command is interupted
|
|
43
|
-
* @param halt Function to execute when command is halted
|
|
44
|
-
*/
|
|
45
|
-
setHalt(halt?: (haltData: RecipleHaltedCommandData<InteractionCommandBuilder>) => Awaitable<boolean | void>): InteractionCommandBuilder;
|
|
46
|
-
/**
|
|
47
|
-
* Function when the command is executed
|
|
48
|
-
* @param execute Function to execute when the command is called
|
|
49
|
-
*/
|
|
50
|
-
setExecute(execute: (executeData: InteractionCommandExecuteData) => void): InteractionCommandBuilder;
|
|
51
|
-
}
|