reciple 3.0.0-pre.1 → 3.0.0
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/CommandCooldownManager.d.ts +2 -2
- package/bin/reciple/classes/RecipleClient.d.ts +11 -10
- package/bin/reciple/classes/RecipleClient.js +56 -42
- package/bin/reciple/classes/RecipleConfig.d.ts +10 -12
- package/bin/reciple/classes/builders/InteractionCommandBuilder.d.ts +2 -1
- package/bin/reciple/classes/builders/InteractionCommandBuilder.js +2 -1
- package/bin/reciple/classes/builders/MessageCommandBuilder.d.ts +2 -1
- package/bin/reciple/classes/builders/MessageCommandBuilder.js +2 -1
- package/bin/reciple/modules.js +4 -2
- package/bin/reciple/permissions.d.ts +1 -1
- package/bin/reciple/registerInteractionCommands.d.ts +4 -5
- package/bin/reciple/registerInteractionCommands.js +21 -18
- package/bin/reciple/types/builders.d.ts +4 -0
- package/bin/reciple/types/builders.js +6 -0
- package/bin/reciple/types/commands.d.ts +15 -8
- package/bin/reciple/types/commands.js +10 -0
- package/bin/reciple/types/paramOptions.d.ts +32 -0
- package/bin/reciple/types/paramOptions.js +2 -0
- package/package.json +13 -5
- package/resource/reciple.yml +24 -24
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { RecipleCommandBuilderType } from '../types/builders';
|
|
1
2
|
import { Guild, TextBasedChannel, User } from 'discord.js';
|
|
2
|
-
import { RecipleCommandBuilders } from '../types/builders';
|
|
3
3
|
export interface CooledDownUser {
|
|
4
4
|
user: User;
|
|
5
5
|
command: string;
|
|
6
|
-
type:
|
|
6
|
+
type: RecipleCommandBuilderType;
|
|
7
7
|
guild?: Guild | null;
|
|
8
8
|
channel?: TextBasedChannel;
|
|
9
9
|
expireTime: number;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import { RecipleCommandBuilders, RecipleCommandBuilderType } from '../types/builders';
|
|
1
2
|
import { InteractionCommandBuilder, RecipleInteractionCommandExecuteData } from './builders/InteractionCommandBuilder';
|
|
2
3
|
import { MessageCommandBuilder, RecipleMessageCommandExecuteData } from './builders/MessageCommandBuilder';
|
|
3
4
|
import { InteractionBuilder } from '../registerInteractionCommands';
|
|
4
|
-
import { RecipleCommandBuilders } from '../types/builders';
|
|
5
5
|
import { CommandCooldownManager } from './CommandCooldownManager';
|
|
6
|
-
import { RecipleModule, RecipleScript } from '../modules';
|
|
7
6
|
import { Logger as ILogger } from 'fallout-utility';
|
|
7
|
+
import { AddModuleOptions } from '../types/paramOptions';
|
|
8
|
+
import { RecipleModule } from '../modules';
|
|
8
9
|
import { Config } from './RecipleConfig';
|
|
9
|
-
import {
|
|
10
|
+
import { ApplicationCommandData, Awaitable, Client, ClientEvents, ClientOptions, CommandInteraction, Interaction, Message } from 'discord.js';
|
|
10
11
|
export interface RecipleClientOptions extends ClientOptions {
|
|
11
12
|
config?: Config;
|
|
12
13
|
}
|
|
13
14
|
export interface RecipleClientCommands {
|
|
14
|
-
|
|
15
|
+
messageCommands: {
|
|
15
16
|
[commandName: string]: MessageCommandBuilder;
|
|
16
17
|
};
|
|
17
|
-
|
|
18
|
+
interactionCommands: {
|
|
18
19
|
[commandName: string]: InteractionCommandBuilder;
|
|
19
20
|
};
|
|
20
21
|
}
|
|
@@ -39,14 +40,14 @@ export interface RecipleClient<Ready extends boolean = boolean> extends Client<R
|
|
|
39
40
|
export declare class RecipleClient<Ready extends boolean = boolean> extends Client<Ready> {
|
|
40
41
|
config: Config;
|
|
41
42
|
commands: RecipleClientCommands;
|
|
42
|
-
otherApplicationCommandData: (InteractionBuilder |
|
|
43
|
+
otherApplicationCommandData: (InteractionBuilder | ApplicationCommandData)[];
|
|
43
44
|
commandCooldowns: CommandCooldownManager;
|
|
44
45
|
modules: RecipleModule[];
|
|
45
46
|
logger: ILogger;
|
|
46
47
|
version: string;
|
|
47
48
|
constructor(options: RecipleClientOptions);
|
|
48
49
|
/**
|
|
49
|
-
* Load modules
|
|
50
|
+
* Load modules from modules folder
|
|
50
51
|
*/
|
|
51
52
|
startModules(folder?: string): Promise<RecipleClient<Ready>>;
|
|
52
53
|
/**
|
|
@@ -56,7 +57,7 @@ export declare class RecipleClient<Ready extends boolean = boolean> extends Clie
|
|
|
56
57
|
/**
|
|
57
58
|
* Add module
|
|
58
59
|
*/
|
|
59
|
-
addModule(
|
|
60
|
+
addModule(options: AddModuleOptions): Promise<void>;
|
|
60
61
|
/**
|
|
61
62
|
* Add interaction or message command to client
|
|
62
63
|
*/
|
|
@@ -80,8 +81,8 @@ export declare class RecipleClient<Ready extends boolean = boolean> extends Clie
|
|
|
80
81
|
/**
|
|
81
82
|
* Get command builder by name or alias if it's a message command
|
|
82
83
|
*/
|
|
83
|
-
findCommand(command: string, type:
|
|
84
|
-
findCommand(command: string, type:
|
|
84
|
+
findCommand(command: string, type: RecipleCommandBuilderType.MessageCommand): MessageCommandBuilder | undefined;
|
|
85
|
+
findCommand(command: string, type: RecipleCommandBuilderType.InteractionCommand): InteractionCommandBuilder | undefined;
|
|
85
86
|
/**
|
|
86
87
|
* Returns true if client logs is enabled
|
|
87
88
|
*/
|
|
@@ -11,12 +11,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.RecipleClient = void 0;
|
|
14
|
+
const builders_1 = require("../types/builders");
|
|
14
15
|
const registerInteractionCommands_1 = require("../registerInteractionCommands");
|
|
15
16
|
const permissions_1 = require("../permissions");
|
|
16
17
|
const CommandCooldownManager_1 = require("./CommandCooldownManager");
|
|
17
18
|
const MessageCommandOptionManager_1 = require("./MessageCommandOptionManager");
|
|
18
|
-
const modules_1 = require("../modules");
|
|
19
19
|
const fallout_utility_1 = require("fallout-utility");
|
|
20
|
+
const commands_1 = require("../types/commands");
|
|
21
|
+
const modules_1 = require("../modules");
|
|
20
22
|
const RecipleConfig_1 = require("./RecipleConfig");
|
|
21
23
|
const isIgnoredChannel_1 = require("../isIgnoredChannel");
|
|
22
24
|
const version_1 = require("../version");
|
|
@@ -27,7 +29,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
27
29
|
var _a, _b, _c;
|
|
28
30
|
super(options);
|
|
29
31
|
this.config = RecipleConfig_1.RecipleConfig.getDefaultConfig();
|
|
30
|
-
this.commands = {
|
|
32
|
+
this.commands = { messageCommands: {}, interactionCommands: {} };
|
|
31
33
|
this.otherApplicationCommandData = [];
|
|
32
34
|
this.commandCooldowns = new CommandCooldownManager_1.CommandCooldownManager();
|
|
33
35
|
this.modules = [];
|
|
@@ -40,7 +42,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
40
42
|
this.logger.logFile(this.config.fileLogging.logFilePath, false);
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
|
-
* Load modules
|
|
45
|
+
* Load modules from modules folder
|
|
44
46
|
*/
|
|
45
47
|
startModules(folder) {
|
|
46
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -79,11 +81,15 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
79
81
|
}
|
|
80
82
|
if (this.isClientLogsEnabled()) {
|
|
81
83
|
this.logger.info(`${this.modules.length} modules loaded.`);
|
|
82
|
-
this.logger.info(`${Object.keys(this.commands.
|
|
83
|
-
this.logger.info(`${Object.keys(this.commands.
|
|
84
|
+
this.logger.info(`${Object.keys(this.commands.messageCommands).length} message commands loaded.`);
|
|
85
|
+
this.logger.info(`${Object.keys(this.commands.interactionCommands).length} interaction commands loaded.`);
|
|
84
86
|
}
|
|
85
87
|
if (this.config.commands.interactionCommand.registerCommands) {
|
|
86
|
-
yield (0, registerInteractionCommands_1.registerInteractionCommands)(
|
|
88
|
+
yield (0, registerInteractionCommands_1.registerInteractionCommands)({
|
|
89
|
+
client: this,
|
|
90
|
+
commands: [...Object.values(this.commands.interactionCommands), ...this.otherApplicationCommandData],
|
|
91
|
+
guilds: this.config.commands.interactionCommand.guilds
|
|
92
|
+
});
|
|
87
93
|
}
|
|
88
94
|
return this;
|
|
89
95
|
});
|
|
@@ -91,9 +97,12 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
91
97
|
/**
|
|
92
98
|
* Add module
|
|
93
99
|
*/
|
|
94
|
-
addModule(
|
|
100
|
+
addModule(options) {
|
|
95
101
|
var _a;
|
|
96
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
const { script } = options;
|
|
104
|
+
const registerCommands = options.registerInteractionCommands;
|
|
105
|
+
const info = options.moduleInfo;
|
|
97
106
|
this.modules.push({
|
|
98
107
|
script,
|
|
99
108
|
info: Object.assign({ filename: undefined, versions: typeof script.versions == 'string' ? [script.versions] : script.versions, path: undefined }, info)
|
|
@@ -107,9 +116,12 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
107
116
|
continue;
|
|
108
117
|
this.addCommand(command);
|
|
109
118
|
}
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
|
|
119
|
+
if (registerCommands)
|
|
120
|
+
yield (0, registerInteractionCommands_1.registerInteractionCommands)({
|
|
121
|
+
client: this,
|
|
122
|
+
commands: [...Object.values(this.commands.interactionCommands), ...this.otherApplicationCommandData],
|
|
123
|
+
guilds: this.config.commands.interactionCommand.guilds
|
|
124
|
+
});
|
|
113
125
|
});
|
|
114
126
|
}
|
|
115
127
|
/**
|
|
@@ -117,11 +129,11 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
117
129
|
*/
|
|
118
130
|
addCommand(command) {
|
|
119
131
|
var _a;
|
|
120
|
-
if (command.builder ===
|
|
121
|
-
this.commands.
|
|
132
|
+
if (command.builder === builders_1.RecipleCommandBuilderType.MessageCommand) {
|
|
133
|
+
this.commands.messageCommands[command.name] = command;
|
|
122
134
|
}
|
|
123
|
-
else if (command.builder ===
|
|
124
|
-
this.commands.
|
|
135
|
+
else if (command.builder === builders_1.RecipleCommandBuilderType.InteractionCommand) {
|
|
136
|
+
this.commands.interactionCommands[command.name] = command;
|
|
125
137
|
}
|
|
126
138
|
else if (this.isClientLogsEnabled()) {
|
|
127
139
|
this.logger.error(`Unknow command "${(_a = typeof command) !== null && _a !== void 0 ? _a : 'unknown'}".`);
|
|
@@ -146,10 +158,10 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
146
158
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
159
|
if (!message.content || !this.isReady())
|
|
148
160
|
return;
|
|
149
|
-
const parseCommand = (0, fallout_utility_1.getCommand)(message.content, prefix || this.config.prefix || '!', this.config.commands.messageCommand.commandArgumentSeparator || ' ');
|
|
161
|
+
const parseCommand = (0, fallout_utility_1.getCommand)(message.content, prefix || this.config.commands.messageCommand.prefix || '!', this.config.commands.messageCommand.commandArgumentSeparator || ' ');
|
|
150
162
|
if (!parseCommand || !(parseCommand === null || parseCommand === void 0 ? void 0 : parseCommand.command))
|
|
151
163
|
return;
|
|
152
|
-
const command = this.findCommand(parseCommand.command,
|
|
164
|
+
const command = this.findCommand(parseCommand.command, builders_1.RecipleCommandBuilderType.MessageCommand);
|
|
153
165
|
if (!command)
|
|
154
166
|
return;
|
|
155
167
|
const commandOptions = command.getCommandOptionValues(parseCommand);
|
|
@@ -160,7 +172,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
160
172
|
builder: command,
|
|
161
173
|
client: this
|
|
162
174
|
};
|
|
163
|
-
if ((0, permissions_1.userHasCommandPermissions)(command.name, (_a = message.member) === null || _a === void 0 ? void 0 : _a.permissions, this.config.permissions
|
|
175
|
+
if ((0, permissions_1.userHasCommandPermissions)(command.name, (_a = message.member) === null || _a === void 0 ? void 0 : _a.permissions, this.config.commands.messageCommand.permissions, command)) {
|
|
164
176
|
if (!command.allowExecuteInDM && message.channel.type === discord_js_1.ChannelType.DM
|
|
165
177
|
|| !command.allowExecuteByBots
|
|
166
178
|
&& (message.author.bot || message.author.system)
|
|
@@ -168,20 +180,20 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
168
180
|
return;
|
|
169
181
|
if (command.validateOptions) {
|
|
170
182
|
if (commandOptions.some(o => o.invalid)) {
|
|
171
|
-
if (!(command === null || command === void 0 ? void 0 : command.halt) || !(yield command.halt({ executeData, reason:
|
|
183
|
+
if (!(command === null || command === void 0 ? void 0 : command.halt) || !(yield command.halt({ executeData, reason: commands_1.RecipleHaltedCommandReason.InvalidArguments, invalidArguments: new MessageCommandOptionManager_1.MessageCommandOptionManager(executeData.options.filter(o => o.invalid)) }))) {
|
|
172
184
|
message.reply(this.getMessage('invalidArguments', 'Invalid argument(s) given.')).catch(er => this._replyError(er));
|
|
173
185
|
}
|
|
174
186
|
return;
|
|
175
187
|
}
|
|
176
188
|
if (commandOptions.some(o => o.missing)) {
|
|
177
|
-
if (!command.halt || !(yield command.halt({ executeData, reason:
|
|
178
|
-
message.reply(this.getMessage('
|
|
189
|
+
if (!command.halt || !(yield command.halt({ executeData, reason: commands_1.RecipleHaltedCommandReason.MissingArguments, missingArguments: new MessageCommandOptionManager_1.MessageCommandOptionManager(executeData.options.filter(o => o.missing)) }))) {
|
|
190
|
+
message.reply(this.getMessage('missingArguments', 'Not enough arguments.')).catch(er => this._replyError(er));
|
|
179
191
|
}
|
|
180
192
|
return;
|
|
181
193
|
}
|
|
182
194
|
}
|
|
183
195
|
if (message.guild && !(0, permissions_1.botHasExecutePermissions)(message.guild, command.requiredBotPermissions)) {
|
|
184
|
-
if (!command.halt || !(yield command.halt({ executeData, reason:
|
|
196
|
+
if (!command.halt || !(yield command.halt({ executeData, reason: commands_1.RecipleHaltedCommandReason.MissingBotPermissions }))) {
|
|
185
197
|
message.reply(this.getMessage('insufficientBotPerms', 'Insufficient bot permissions.')).catch(er => this._replyError(er));
|
|
186
198
|
}
|
|
187
199
|
return;
|
|
@@ -191,29 +203,30 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
191
203
|
command: command.name,
|
|
192
204
|
channel: message.channel,
|
|
193
205
|
guild: message.guild,
|
|
194
|
-
type:
|
|
206
|
+
type: builders_1.RecipleCommandBuilderType.MessageCommand
|
|
195
207
|
};
|
|
196
208
|
if (this.config.commands.messageCommand.enableCooldown && command.cooldown && !this.commandCooldowns.isCooledDown(userCooldown)) {
|
|
197
209
|
this.commandCooldowns.add(Object.assign(Object.assign({}, userCooldown), { expireTime: Date.now() + command.cooldown }));
|
|
198
210
|
}
|
|
199
211
|
else if (this.config.commands.messageCommand.enableCooldown && command.cooldown) {
|
|
200
|
-
if (!command.halt || !(yield command.halt(Object.assign({ executeData, reason:
|
|
212
|
+
if (!command.halt || !(yield command.halt(Object.assign({ executeData, reason: commands_1.RecipleHaltedCommandReason.Cooldown }, this.commandCooldowns.get(userCooldown))))) {
|
|
201
213
|
yield message.reply(this.getMessage('cooldown', 'You cannot execute this command right now due to the cooldown.')).catch(er => this._replyError(er));
|
|
202
214
|
}
|
|
203
215
|
return;
|
|
204
216
|
}
|
|
205
217
|
try {
|
|
206
|
-
yield Promise.resolve(command.execute(executeData))
|
|
207
|
-
|
|
218
|
+
yield Promise.resolve(command.execute(executeData))
|
|
219
|
+
.then(() => this.emit('recipleMessageCommandCreate', executeData))
|
|
220
|
+
.catch((err) => __awaiter(this, void 0, void 0, function* () { return !command.halt || !(yield command.halt({ executeData, reason: commands_1.RecipleHaltedCommandReason.Error, error: err })) ? this._commandExecuteError(err, executeData) : void 0; }));
|
|
208
221
|
return executeData;
|
|
209
222
|
}
|
|
210
223
|
catch (err) {
|
|
211
|
-
if (!command.halt || !(yield command.halt({ executeData, reason:
|
|
224
|
+
if (!command.halt || !(yield command.halt({ executeData, reason: commands_1.RecipleHaltedCommandReason.Error, error: err }))) {
|
|
212
225
|
this._commandExecuteError(err, executeData);
|
|
213
226
|
}
|
|
214
227
|
}
|
|
215
228
|
}
|
|
216
|
-
else if (!command.halt || !(yield command.halt({ executeData, reason:
|
|
229
|
+
else if (!command.halt || !(yield command.halt({ executeData, reason: commands_1.RecipleHaltedCommandReason.MissingMemberPermissions }))) {
|
|
217
230
|
message.reply(this.getMessage('noPermissions', 'You do not have permission to use this command.')).catch(er => this._replyError(er));
|
|
218
231
|
}
|
|
219
232
|
});
|
|
@@ -226,7 +239,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
226
239
|
return __awaiter(this, void 0, void 0, function* () {
|
|
227
240
|
if (!interaction || interaction.type !== discord_js_1.InteractionType.ApplicationCommand || !this.isReady())
|
|
228
241
|
return;
|
|
229
|
-
const command = this.findCommand(interaction.commandName,
|
|
242
|
+
const command = this.findCommand(interaction.commandName, builders_1.RecipleCommandBuilderType.InteractionCommand);
|
|
230
243
|
if (!command)
|
|
231
244
|
return;
|
|
232
245
|
const executeData = {
|
|
@@ -234,11 +247,11 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
234
247
|
builder: command,
|
|
235
248
|
client: this
|
|
236
249
|
};
|
|
237
|
-
if ((0, permissions_1.userHasCommandPermissions)(command.name, (_a = interaction.memberPermissions) !== null && _a !== void 0 ? _a : undefined, this.config.permissions
|
|
250
|
+
if ((0, permissions_1.userHasCommandPermissions)(command.name, (_a = interaction.memberPermissions) !== null && _a !== void 0 ? _a : undefined, this.config.commands.interactionCommand.permissions, command)) {
|
|
238
251
|
if (!command || (0, isIgnoredChannel_1.isIgnoredChannel)(interaction.channelId, this.config.ignoredChannels))
|
|
239
252
|
return;
|
|
240
253
|
if (interaction.guild && !(0, permissions_1.botHasExecutePermissions)(interaction.guild, command.requiredBotPermissions)) {
|
|
241
|
-
if (!command.halt || !(yield command.halt({ executeData, reason:
|
|
254
|
+
if (!command.halt || !(yield command.halt({ executeData, reason: commands_1.RecipleHaltedCommandReason.MissingBotPermissions }))) {
|
|
242
255
|
yield interaction.reply(this.getMessage('insufficientBotPerms', 'Insufficient bot permissions.')).catch(er => this._replyError(er));
|
|
243
256
|
}
|
|
244
257
|
return;
|
|
@@ -248,29 +261,30 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
248
261
|
command: command.name,
|
|
249
262
|
channel: (_b = interaction.channel) !== null && _b !== void 0 ? _b : undefined,
|
|
250
263
|
guild: interaction.guild,
|
|
251
|
-
type:
|
|
264
|
+
type: builders_1.RecipleCommandBuilderType.InteractionCommand
|
|
252
265
|
};
|
|
253
266
|
if (this.config.commands.interactionCommand.enableCooldown && command.cooldown && !this.commandCooldowns.isCooledDown(userCooldown)) {
|
|
254
267
|
this.commandCooldowns.add(Object.assign(Object.assign({}, userCooldown), { expireTime: Date.now() + command.cooldown }));
|
|
255
268
|
}
|
|
256
269
|
else if (this.config.commands.interactionCommand.enableCooldown && command.cooldown) {
|
|
257
|
-
if (!command.halt || !(yield command.halt(Object.assign({ executeData, reason:
|
|
270
|
+
if (!command.halt || !(yield command.halt(Object.assign({ executeData, reason: commands_1.RecipleHaltedCommandReason.Cooldown }, this.commandCooldowns.get(userCooldown))))) {
|
|
258
271
|
yield interaction.reply(this.getMessage('cooldown', 'You cannot execute this command right now due to the cooldown.')).catch(er => this._replyError(er));
|
|
259
272
|
}
|
|
260
273
|
return;
|
|
261
274
|
}
|
|
262
275
|
try {
|
|
263
|
-
yield Promise.resolve(command.execute(executeData))
|
|
264
|
-
|
|
276
|
+
yield Promise.resolve(command.execute(executeData))
|
|
277
|
+
.then(() => this.emit('recipleInteractionCommandCreate', executeData))
|
|
278
|
+
.catch((err) => __awaiter(this, void 0, void 0, function* () { return !command.halt || !(yield command.halt({ executeData, reason: commands_1.RecipleHaltedCommandReason.Error, error: err })) ? this._commandExecuteError(err, executeData) : void 0; }));
|
|
265
279
|
return executeData;
|
|
266
280
|
}
|
|
267
281
|
catch (err) {
|
|
268
|
-
if (!command.halt || !(yield command.halt({ executeData, reason:
|
|
282
|
+
if (!command.halt || !(yield command.halt({ executeData, reason: commands_1.RecipleHaltedCommandReason.Error, error: err }))) {
|
|
269
283
|
this._commandExecuteError(err, executeData);
|
|
270
284
|
}
|
|
271
285
|
}
|
|
272
286
|
}
|
|
273
|
-
else if (!command.halt || !(yield command.halt({ executeData, reason:
|
|
287
|
+
else if (!command.halt || !(yield command.halt({ executeData, reason: commands_1.RecipleHaltedCommandReason.MissingMemberPermissions }))) {
|
|
274
288
|
yield interaction.reply(this.getMessage('noPermissions', 'You do not have permission to use this command.')).catch(er => this._replyError(er));
|
|
275
289
|
}
|
|
276
290
|
});
|
|
@@ -285,11 +299,11 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
285
299
|
findCommand(command, type) {
|
|
286
300
|
var _a;
|
|
287
301
|
switch (type) {
|
|
288
|
-
case
|
|
289
|
-
return this.commands.
|
|
290
|
-
case
|
|
291
|
-
return (_a = this.commands.
|
|
292
|
-
? Object.values(this.commands.
|
|
302
|
+
case builders_1.RecipleCommandBuilderType.InteractionCommand:
|
|
303
|
+
return this.commands.interactionCommands[command];
|
|
304
|
+
case builders_1.RecipleCommandBuilderType.MessageCommand:
|
|
305
|
+
return (_a = this.commands.messageCommands[command.toLowerCase()]) !== null && _a !== void 0 ? _a : (this.config.commands.messageCommand.allowCommandAlias
|
|
306
|
+
? Object.values(this.commands.messageCommands).find(c => c.aliases.some(a => a == (command === null || command === void 0 ? void 0 : command.toLowerCase())))
|
|
293
307
|
: undefined);
|
|
294
308
|
default:
|
|
295
309
|
throw new TypeError('Unknown command type');
|
|
@@ -313,7 +327,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
313
327
|
_commandExecuteError(err, command) {
|
|
314
328
|
return __awaiter(this, void 0, void 0, function* () {
|
|
315
329
|
if (this.isClientLogsEnabled()) {
|
|
316
|
-
this.logger.error(`An error occured executing ${command.builder.builder ==
|
|
330
|
+
this.logger.error(`An error occured executing ${command.builder.builder == builders_1.RecipleCommandBuilderType.MessageCommand ? 'message' : 'interaction'} command "${command.builder.name}"`);
|
|
317
331
|
this.logger.error(err);
|
|
318
332
|
}
|
|
319
333
|
if (!err || !command)
|
|
@@ -5,14 +5,18 @@ export interface ConfigCommandPermissions {
|
|
|
5
5
|
}
|
|
6
6
|
export interface Config {
|
|
7
7
|
token: string;
|
|
8
|
-
prefix: string;
|
|
9
8
|
commands: {
|
|
10
9
|
messageCommand: {
|
|
11
10
|
enabled: boolean;
|
|
11
|
+
prefix?: string;
|
|
12
12
|
replyOnError: boolean;
|
|
13
13
|
allowCommandAlias: boolean;
|
|
14
14
|
enableCooldown: boolean;
|
|
15
15
|
commandArgumentSeparator: string;
|
|
16
|
+
permissions: {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
commands: ConfigCommandPermissions[];
|
|
19
|
+
};
|
|
16
20
|
};
|
|
17
21
|
interactionCommand: {
|
|
18
22
|
enabled: boolean;
|
|
@@ -20,17 +24,11 @@ export interface Config {
|
|
|
20
24
|
registerCommands: boolean;
|
|
21
25
|
enableCooldown: boolean;
|
|
22
26
|
setRequiredPermissions: boolean;
|
|
23
|
-
guilds
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
enabled: boolean;
|
|
29
|
-
commands: ConfigCommandPermissions[];
|
|
30
|
-
};
|
|
31
|
-
interactionCommands: {
|
|
32
|
-
enabled: boolean;
|
|
33
|
-
commands: ConfigCommandPermissions[];
|
|
27
|
+
guilds?: string[] | string;
|
|
28
|
+
permissions: {
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
commands: ConfigCommandPermissions[];
|
|
31
|
+
};
|
|
34
32
|
};
|
|
35
33
|
};
|
|
36
34
|
ignoredChannels: {
|
|
@@ -2,13 +2,14 @@ import { Awaitable, CommandInteraction, PermissionResolvable } from 'discord.js'
|
|
|
2
2
|
import { RecipleHaltedCommandData } from '../../types/commands';
|
|
3
3
|
import { SlashCommandBuilder } from '@discordjs/builders';
|
|
4
4
|
import { RecipleClient } from '../RecipleClient';
|
|
5
|
+
import { RecipleCommandBuilderType } from '../../types/builders';
|
|
5
6
|
export interface RecipleInteractionCommandExecuteData {
|
|
6
7
|
interaction: CommandInteraction;
|
|
7
8
|
builder: InteractionCommandBuilder;
|
|
8
9
|
client: RecipleClient<true>;
|
|
9
10
|
}
|
|
10
11
|
export declare class InteractionCommandBuilder extends SlashCommandBuilder {
|
|
11
|
-
readonly builder =
|
|
12
|
+
readonly builder = RecipleCommandBuilderType.InteractionCommand;
|
|
12
13
|
cooldown: number;
|
|
13
14
|
requiredBotPermissions: PermissionResolvable[];
|
|
14
15
|
RequiredUserPermissions: PermissionResolvable[];
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InteractionCommandBuilder = void 0;
|
|
4
4
|
const builders_1 = require("@discordjs/builders");
|
|
5
|
+
const builders_2 = require("../../types/builders");
|
|
5
6
|
class InteractionCommandBuilder extends builders_1.SlashCommandBuilder {
|
|
6
7
|
constructor() {
|
|
7
8
|
super(...arguments);
|
|
8
|
-
this.builder =
|
|
9
|
+
this.builder = builders_2.RecipleCommandBuilderType.InteractionCommand;
|
|
9
10
|
this.cooldown = 0;
|
|
10
11
|
this.requiredBotPermissions = [];
|
|
11
12
|
this.RequiredUserPermissions = [];
|
|
@@ -4,6 +4,7 @@ import { Awaitable, Message, PermissionResolvable } from 'discord.js';
|
|
|
4
4
|
import { RecipleHaltedCommandData } from '../../types/commands';
|
|
5
5
|
import { Command as CommandMessage } from 'fallout-utility';
|
|
6
6
|
import { RecipleClient } from '../RecipleClient';
|
|
7
|
+
import { RecipleCommandBuilderType } from '../../types/builders';
|
|
7
8
|
export interface RecipleMessageCommandExecuteData {
|
|
8
9
|
message: Message;
|
|
9
10
|
options: MessageCommandOptionManager;
|
|
@@ -19,7 +20,7 @@ export interface MessageCommandValidatedOption {
|
|
|
19
20
|
missing: boolean;
|
|
20
21
|
}
|
|
21
22
|
export declare class MessageCommandBuilder {
|
|
22
|
-
readonly builder =
|
|
23
|
+
readonly builder = RecipleCommandBuilderType.MessageCommand;
|
|
23
24
|
name: string;
|
|
24
25
|
cooldown: number;
|
|
25
26
|
description: string;
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MessageCommandBuilder = void 0;
|
|
4
4
|
const MessageCommandOptionBuilder_1 = require("./MessageCommandOptionBuilder");
|
|
5
|
+
const builders_1 = require("../../types/builders");
|
|
5
6
|
class MessageCommandBuilder {
|
|
6
7
|
constructor() {
|
|
7
|
-
this.builder =
|
|
8
|
+
this.builder = builders_1.RecipleCommandBuilderType.MessageCommand;
|
|
8
9
|
this.name = '';
|
|
9
10
|
this.cooldown = 0;
|
|
10
11
|
this.description = '';
|
package/bin/reciple/modules.js
CHANGED
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.loadModules = void 0;
|
|
16
|
+
const builders_1 = require("./types/builders");
|
|
16
17
|
const fs_1 = require("fs");
|
|
17
18
|
const version_1 = require("./version");
|
|
18
19
|
const wildcard_match_1 = __importDefault(require("wildcard-match"));
|
|
@@ -47,8 +48,9 @@ function loadModules(client, folder) {
|
|
|
47
48
|
throw new Error(script + ' onStart is not defined or returned false.');
|
|
48
49
|
if (module_.commands) {
|
|
49
50
|
for (const command of module_.commands) {
|
|
50
|
-
if (command.builder ===
|
|
51
|
+
if (command.builder === builders_1.RecipleCommandBuilderType.MessageCommand || command.builder === builders_1.RecipleCommandBuilderType.InteractionCommand) {
|
|
51
52
|
commands.push(command);
|
|
53
|
+
}
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
}
|
|
@@ -65,7 +67,7 @@ function loadModules(client, folder) {
|
|
|
65
67
|
client.logger.error(`A ${c.builder} command name is not defined in ${script}`);
|
|
66
68
|
return false;
|
|
67
69
|
}
|
|
68
|
-
if (c.builder ===
|
|
70
|
+
if (c.builder === builders_1.RecipleCommandBuilderType.MessageCommand && c.options.length && c.options.some(o => !o.name)) {
|
|
69
71
|
if (client.isClientLogsEnabled())
|
|
70
72
|
client.logger.error(`A ${c.builder} option name is not defined in ${script}`);
|
|
71
73
|
return false;
|
|
@@ -4,5 +4,5 @@ import { Config } from './classes/RecipleConfig';
|
|
|
4
4
|
/**
|
|
5
5
|
* Check if the user has permissions to execute the given command name
|
|
6
6
|
*/
|
|
7
|
-
export declare function userHasCommandPermissions(commandName: string, memberPermissions?: PermissionsBitField, configConmmandPermissions?: Config['
|
|
7
|
+
export declare function userHasCommandPermissions(commandName: string, memberPermissions?: PermissionsBitField, configConmmandPermissions?: Config['commands']['messageCommand']['permissions'] | Config['commands']['interactionCommand']['permissions'], builder?: RecipleCommandBuilders): boolean;
|
|
8
8
|
export declare function botHasExecutePermissions(guild?: Guild, requiredPermissions?: PermissionResolvable[]): boolean;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { InteractionCommandBuilder } from './classes/builders/InteractionCommandBuilder';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare type InteractionBuilder = InteractionCommandBuilder | ContextMenuCommandBuilder | SlashCommandBuilder | SlashCommandSubcommandBuilder | SlashCommandOptionsOnlyBuilder | SlashCommandSubcommandGroupBuilder | SlashCommandSubcommandsOnlyBuilder;
|
|
2
|
+
import { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
|
3
|
+
import { RegisterInteractionCommandsOptions } from './types/paramOptions';
|
|
4
|
+
export declare type InteractionBuilder = ContextMenuCommandBuilder | InteractionCommandBuilder | SlashCommandBuilder;
|
|
6
5
|
/**
|
|
7
6
|
* Register interaction commands
|
|
8
7
|
*/
|
|
9
|
-
export declare function registerInteractionCommands(
|
|
8
|
+
export declare function registerInteractionCommands(options: RegisterInteractionCommandsOptions): Promise<void>;
|
|
@@ -10,33 +10,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.registerInteractionCommands = void 0;
|
|
13
|
+
const InteractionCommandBuilder_1 = require("./classes/builders/InteractionCommandBuilder");
|
|
13
14
|
/**
|
|
14
15
|
* Register interaction commands
|
|
15
16
|
*/
|
|
16
|
-
function registerInteractionCommands(
|
|
17
|
-
var _a, _b, _c;
|
|
17
|
+
function registerInteractionCommands(options) {
|
|
18
|
+
var _a, _b, _c, _d;
|
|
18
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
let { client, guilds } = options;
|
|
21
|
+
guilds = typeof guilds == 'string' ? [guilds] : guilds;
|
|
22
|
+
const commands = (_b = Object.values((_a = options.commands) !== null && _a !== void 0 ? _a : client.commands.interactionCommands).map(cmd => {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
if (typeof (cmd === null || cmd === void 0 ? void 0 : cmd.toJSON) == 'undefined')
|
|
25
|
+
return cmd;
|
|
26
|
+
cmd = cmd;
|
|
27
|
+
if (cmd instanceof InteractionCommandBuilder_1.InteractionCommandBuilder && client.config.commands.interactionCommand.setRequiredPermissions) {
|
|
28
|
+
const permissions = (_b = (client.config.commands.interactionCommand.permissions.enabled ?
|
|
29
|
+
(_a = client.config.commands.interactionCommand.permissions.commands.find(cmd_ => cmd_.command.toLowerCase() === cmd.name.toLowerCase())) === null || _a === void 0 ? void 0 : _a.permissions :
|
|
30
|
+
undefined)) !== null && _b !== void 0 ? _b : cmd.requiredBotPermissions;
|
|
28
31
|
cmd.setRequiredMemberPermissions(permissions);
|
|
29
|
-
client.commands.
|
|
32
|
+
client.commands.interactionCommands[cmd.name] = cmd;
|
|
30
33
|
if (client.isClientLogsEnabled())
|
|
31
34
|
client.logger.debug(`Set required permissions for ${cmd.name}`);
|
|
32
35
|
return cmd.toJSON();
|
|
33
36
|
}
|
|
34
|
-
return
|
|
35
|
-
})) !== null &&
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
return cmd.toJSON();
|
|
38
|
+
})) !== null && _b !== void 0 ? _b : [];
|
|
39
|
+
if (!client.isReady())
|
|
40
|
+
throw new Error('Client is not ready');
|
|
38
41
|
if (!guilds || !(guilds === null || guilds === void 0 ? void 0 : guilds.length)) {
|
|
39
|
-
(
|
|
42
|
+
(_c = client.application) === null || _c === void 0 ? void 0 : _c.commands.set(commands).then(() => {
|
|
40
43
|
if (client.isClientLogsEnabled())
|
|
41
44
|
client.logger.warn('No guilds were specified for interaction commands. Registered interaction commands globally.');
|
|
42
45
|
});
|
|
@@ -47,7 +50,7 @@ function registerInteractionCommands(client, cmds, overwriteGuilds) {
|
|
|
47
50
|
for (const guild of guilds) {
|
|
48
51
|
if (!guild)
|
|
49
52
|
continue;
|
|
50
|
-
(
|
|
53
|
+
(_d = client.application) === null || _d === void 0 ? void 0 : _d.commands.set(commands, guild).then(() => {
|
|
51
54
|
if (client.isClientLogsEnabled())
|
|
52
55
|
client.logger.warn(`Registered ${commands.length} interaction command(s) for ${guild}.`);
|
|
53
56
|
});
|
|
@@ -2,3 +2,7 @@ import { InteractionCommandBuilder, RecipleInteractionCommandExecuteData } from
|
|
|
2
2
|
import { MessageCommandBuilder, RecipleMessageCommandExecuteData } from '../classes/builders/MessageCommandBuilder';
|
|
3
3
|
export declare type RecipleCommandBuilders = MessageCommandBuilder | InteractionCommandBuilder;
|
|
4
4
|
export declare type RecipleCommandBuildersExecuteData = RecipleInteractionCommandExecuteData | RecipleMessageCommandExecuteData;
|
|
5
|
+
export declare enum RecipleCommandBuilderType {
|
|
6
|
+
MessageCommand = 0,
|
|
7
|
+
InteractionCommand = 1
|
|
8
|
+
}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecipleCommandBuilderType = void 0;
|
|
4
|
+
var RecipleCommandBuilderType;
|
|
5
|
+
(function (RecipleCommandBuilderType) {
|
|
6
|
+
RecipleCommandBuilderType[RecipleCommandBuilderType["MessageCommand"] = 0] = "MessageCommand";
|
|
7
|
+
RecipleCommandBuilderType[RecipleCommandBuilderType["InteractionCommand"] = 1] = "InteractionCommand";
|
|
8
|
+
})(RecipleCommandBuilderType = exports.RecipleCommandBuilderType || (exports.RecipleCommandBuilderType = {}));
|
|
@@ -3,29 +3,36 @@ import { RecipleMessageCommandExecuteData } from '../classes/builders/MessageCom
|
|
|
3
3
|
import { MessageCommandOptionManager } from '../classes/MessageCommandOptionManager';
|
|
4
4
|
import { CooledDownUser } from '../classes/CommandCooldownManager';
|
|
5
5
|
import { RecipleCommandBuilders } from '../types/builders';
|
|
6
|
-
export declare type
|
|
7
|
-
export declare type RecipleHaltedCommandData<Builder extends RecipleCommandBuilders> = CommandErrorData<Builder> | CommandCooldownData<Builder> | CommandInvalidArguments<Builder> | CommandMissingArguments<Builder> | CommandMissingMemberPermissions<Builder> | CommandMissingBotPermissions<Builder>;
|
|
6
|
+
export declare type RecipleHaltedCommandData<Builder extends RecipleCommandBuilders> = CommandErrorData<Builder> | CommandCooldownData<Builder> | (Builder extends InteractionCommandBuilder ? never : CommandInvalidArguments<Builder> | CommandMissingArguments<Builder>) | CommandMissingMemberPermissions<Builder> | CommandMissingBotPermissions<Builder>;
|
|
8
7
|
export interface CommandHaltBaseData<Builder extends RecipleCommandBuilders> {
|
|
9
8
|
executeData: Builder extends InteractionCommandBuilder ? RecipleInteractionCommandExecuteData : RecipleMessageCommandExecuteData;
|
|
10
9
|
}
|
|
11
10
|
export interface CommandErrorData<Builder extends RecipleCommandBuilders> extends CommandHaltBaseData<Builder> {
|
|
12
|
-
reason:
|
|
11
|
+
reason: RecipleHaltedCommandReason.Error;
|
|
13
12
|
error: any;
|
|
14
13
|
}
|
|
15
14
|
export interface CommandCooldownData<Builder extends RecipleCommandBuilders> extends CommandHaltBaseData<Builder>, CooledDownUser {
|
|
16
|
-
reason:
|
|
15
|
+
reason: RecipleHaltedCommandReason.Cooldown;
|
|
17
16
|
}
|
|
18
17
|
export interface CommandInvalidArguments<Builder extends RecipleCommandBuilders> extends CommandHaltBaseData<Builder> {
|
|
19
|
-
reason:
|
|
18
|
+
reason: RecipleHaltedCommandReason.InvalidArguments;
|
|
20
19
|
invalidArguments: MessageCommandOptionManager;
|
|
21
20
|
}
|
|
22
21
|
export interface CommandMissingArguments<Builder extends RecipleCommandBuilders> extends CommandHaltBaseData<Builder> {
|
|
23
|
-
reason:
|
|
22
|
+
reason: RecipleHaltedCommandReason.MissingArguments;
|
|
24
23
|
missingArguments: MessageCommandOptionManager;
|
|
25
24
|
}
|
|
26
25
|
export interface CommandMissingMemberPermissions<Builder extends RecipleCommandBuilders> extends CommandHaltBaseData<Builder> {
|
|
27
|
-
reason:
|
|
26
|
+
reason: RecipleHaltedCommandReason.MissingMemberPermissions;
|
|
28
27
|
}
|
|
29
28
|
export interface CommandMissingBotPermissions<Builder extends RecipleCommandBuilders> extends CommandHaltBaseData<Builder> {
|
|
30
|
-
reason:
|
|
29
|
+
reason: RecipleHaltedCommandReason.MissingBotPermissions;
|
|
30
|
+
}
|
|
31
|
+
export declare enum RecipleHaltedCommandReason {
|
|
32
|
+
Error = 0,
|
|
33
|
+
Cooldown = 1,
|
|
34
|
+
InvalidArguments = 2,
|
|
35
|
+
MissingArguments = 3,
|
|
36
|
+
MissingMemberPermissions = 4,
|
|
37
|
+
MissingBotPermissions = 5
|
|
31
38
|
}
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecipleHaltedCommandReason = void 0;
|
|
4
|
+
var RecipleHaltedCommandReason;
|
|
5
|
+
(function (RecipleHaltedCommandReason) {
|
|
6
|
+
RecipleHaltedCommandReason[RecipleHaltedCommandReason["Error"] = 0] = "Error";
|
|
7
|
+
RecipleHaltedCommandReason[RecipleHaltedCommandReason["Cooldown"] = 1] = "Cooldown";
|
|
8
|
+
RecipleHaltedCommandReason[RecipleHaltedCommandReason["InvalidArguments"] = 2] = "InvalidArguments";
|
|
9
|
+
RecipleHaltedCommandReason[RecipleHaltedCommandReason["MissingArguments"] = 3] = "MissingArguments";
|
|
10
|
+
RecipleHaltedCommandReason[RecipleHaltedCommandReason["MissingMemberPermissions"] = 4] = "MissingMemberPermissions";
|
|
11
|
+
RecipleHaltedCommandReason[RecipleHaltedCommandReason["MissingBotPermissions"] = 5] = "MissingBotPermissions";
|
|
12
|
+
})(RecipleHaltedCommandReason = exports.RecipleHaltedCommandReason || (exports.RecipleHaltedCommandReason = {}));
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { InteractionBuilder } from '../registerInteractionCommands';
|
|
2
|
+
import { RecipleModule, RecipleScript } from '../modules';
|
|
3
|
+
import { RecipleClient } from '../classes/RecipleClient';
|
|
4
|
+
import { ApplicationCommandData } from 'discord.js';
|
|
5
|
+
export interface AddModuleOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The Module script
|
|
8
|
+
*/
|
|
9
|
+
script: RecipleScript;
|
|
10
|
+
/**
|
|
11
|
+
* Register interaction commands if possible
|
|
12
|
+
*/
|
|
13
|
+
registerInteractionCommands?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Module optional info
|
|
16
|
+
*/
|
|
17
|
+
moduleInfo?: RecipleModule["info"];
|
|
18
|
+
}
|
|
19
|
+
export interface RegisterInteractionCommandsOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Bot client
|
|
22
|
+
*/
|
|
23
|
+
client: RecipleClient;
|
|
24
|
+
/**
|
|
25
|
+
* Commands to register
|
|
26
|
+
*/
|
|
27
|
+
commands: (ApplicationCommandData | InteractionBuilder)[];
|
|
28
|
+
/**
|
|
29
|
+
* Set guild to not register commands globally
|
|
30
|
+
*/
|
|
31
|
+
guilds?: string | string[];
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reciple",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Handler for Discord.js",
|
|
5
5
|
"author": "FalloutStudios",
|
|
6
6
|
"homepage": "https://reciple.js.org",
|
|
7
|
+
"contributors": [
|
|
8
|
+
"GhexterCortes <cortesghexter@gmail.com>"
|
|
9
|
+
],
|
|
7
10
|
"bugs": {
|
|
8
11
|
"url": "https://github.com/FalloutStudios/reciple/issues"
|
|
9
12
|
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/FalloutStudios/reciple.git"
|
|
16
|
+
},
|
|
10
17
|
"license": "GPL-3.0",
|
|
11
18
|
"main": "bin/index.js",
|
|
12
19
|
"bin": {
|
|
@@ -44,12 +51,13 @@
|
|
|
44
51
|
"yaml": "^2.1.1"
|
|
45
52
|
},
|
|
46
53
|
"devDependencies": {
|
|
47
|
-
"@types/node": "^18.0.
|
|
54
|
+
"@types/node": "^18.0.6",
|
|
48
55
|
"@types/semver": "^7.3.10",
|
|
49
|
-
"discord.js": "^14.0.
|
|
56
|
+
"discord.js": "^14.0.3",
|
|
50
57
|
"typescript": "^4.7.4"
|
|
51
58
|
},
|
|
52
59
|
"peerDependencies": {
|
|
53
|
-
"discord.js": "
|
|
54
|
-
}
|
|
60
|
+
"discord.js": "14.0.x"
|
|
61
|
+
},
|
|
62
|
+
"packageManager": "yarn@1.22.19"
|
|
55
63
|
}
|
package/resource/reciple.yml
CHANGED
|
@@ -2,52 +2,49 @@
|
|
|
2
2
|
# To use env variable as a token just do it like this env:TOKEN_ENV
|
|
3
3
|
token: TOKEN
|
|
4
4
|
|
|
5
|
-
# Message command prefix
|
|
6
|
-
prefix: '!'
|
|
7
|
-
|
|
8
5
|
|
|
9
6
|
# Commands options
|
|
10
7
|
commands:
|
|
11
8
|
messageCommand:
|
|
12
9
|
# enable message commands
|
|
13
10
|
enabled: true
|
|
11
|
+
# command prefix
|
|
12
|
+
prefix: '!'
|
|
14
13
|
# reply when an error occured
|
|
15
14
|
replyOnError: false
|
|
16
15
|
# Enable the use of command cooldowns
|
|
17
|
-
enableCooldown:
|
|
16
|
+
enableCooldown: true
|
|
18
17
|
# Allow executing commands via aliases
|
|
19
18
|
allowCommandAlias: true
|
|
20
19
|
# command argument separator
|
|
21
20
|
commandArgumentSeparator: ' '
|
|
21
|
+
# Overwrite command permissions
|
|
22
|
+
permissions:
|
|
23
|
+
# enable overwriten command permissions
|
|
24
|
+
enabled: false
|
|
25
|
+
commands:
|
|
26
|
+
- command: 'example-command'
|
|
27
|
+
permissions: ['Administrator']
|
|
22
28
|
interactionCommand:
|
|
23
29
|
# enable interaction commands
|
|
24
30
|
enabled: true
|
|
25
31
|
# reply when an error occured
|
|
26
32
|
replyOnError: false
|
|
27
33
|
# Enable the use of command cooldowns
|
|
28
|
-
enableCooldown:
|
|
34
|
+
enableCooldown: true
|
|
29
35
|
# register interaction commands on bot ready
|
|
30
36
|
registerCommands: true
|
|
31
37
|
# set required permissions for interaction commands
|
|
32
38
|
setRequiredPermissions: true
|
|
33
39
|
# register commands to specific guild(s) empty to make it global
|
|
34
40
|
guilds: []
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
#
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
commands:
|
|
43
|
-
- command: 'stop'
|
|
44
|
-
permissions: ['ADMINISTRATOR']
|
|
45
|
-
interactionCommands:
|
|
46
|
-
# enable command permissions
|
|
47
|
-
enabled: true
|
|
48
|
-
commands:
|
|
49
|
-
- command: 'stop'
|
|
50
|
-
permissions: ['ADMINISTRATOR']
|
|
41
|
+
# Overwrite command permissions
|
|
42
|
+
permissions:
|
|
43
|
+
# enable overwriten command permissions
|
|
44
|
+
enabled: false
|
|
45
|
+
commands:
|
|
46
|
+
- command: 'example-command'
|
|
47
|
+
permissions: ['Administrator']
|
|
51
48
|
|
|
52
49
|
|
|
53
50
|
# Ignored channel IDs
|
|
@@ -74,13 +71,16 @@ fileLogging:
|
|
|
74
71
|
logFilePath: './logs/latest.log'
|
|
75
72
|
|
|
76
73
|
# Client options
|
|
77
|
-
# Use an intent calculator like https://discord-intents-calculator.vercel.app/ to get valid intents
|
|
78
74
|
client:
|
|
79
|
-
intents:
|
|
75
|
+
intents:
|
|
76
|
+
- 'Guilds'
|
|
77
|
+
- 'GuildMembers'
|
|
78
|
+
- 'GuildMessages'
|
|
79
|
+
- 'MessageContent'
|
|
80
80
|
|
|
81
81
|
# Bot replies
|
|
82
82
|
messages:
|
|
83
|
-
|
|
83
|
+
missingArguments: 'Not enough arguments.'
|
|
84
84
|
invalidArguments: 'Invalid argument(s) given.'
|
|
85
85
|
insufficientBotPerms:
|
|
86
86
|
content: 'Insufficient bot permissions.'
|