reciple 5.4.0-pre.1 → 5.4.0-pre.2
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.js +2 -3
- package/bin/reciple/classes/builders/MessageCommandBuilder.d.ts +1 -0
- package/bin/reciple/classes/builders/MessageCommandBuilder.js +3 -0
- package/bin/reciple/classes/builders/SlashCommandBuilder.d.ts +2 -1
- package/bin/reciple/classes/builders/SlashCommandBuilder.js +3 -0
- package/bin/reciple/modules.js +2 -2
- package/bin/reciple/types/builders.d.ts +6 -6
- package/package.json +1 -1
|
@@ -29,7 +29,6 @@ const version_1 = require("../version");
|
|
|
29
29
|
const discord_js_1 = require("discord.js");
|
|
30
30
|
const path_1 = __importDefault(require("path"));
|
|
31
31
|
const flags_1 = require("../flags");
|
|
32
|
-
const util_1 = require("../util");
|
|
33
32
|
class RecipleClient extends discord_js_1.Client {
|
|
34
33
|
/**
|
|
35
34
|
* @param options Client options
|
|
@@ -148,10 +147,10 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
148
147
|
addCommand(command) {
|
|
149
148
|
var _a;
|
|
150
149
|
if (command.type === builders_1.CommandBuilderType.SlashCommand) {
|
|
151
|
-
this.commands.slashCommands[command.name] =
|
|
150
|
+
this.commands.slashCommands[command.name] = SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(command);
|
|
152
151
|
}
|
|
153
152
|
else if (command.type === builders_1.CommandBuilderType.MessageCommand) {
|
|
154
|
-
this.commands.messageCommands[command.name] =
|
|
153
|
+
this.commands.messageCommands[command.name] = MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(command);
|
|
155
154
|
}
|
|
156
155
|
else if (this.isClientLogsEnabled()) {
|
|
157
156
|
this.logger.error(`Unknow command "${(_a = typeof command) !== null && _a !== void 0 ? _a : 'unknown'}".`);
|
|
@@ -97,6 +97,7 @@ export declare class MessageCommandBuilder implements SharedCommandBuilderProper
|
|
|
97
97
|
* Returns JSON object of this builder
|
|
98
98
|
*/
|
|
99
99
|
toJSON(): MessageCommandData;
|
|
100
|
+
static resolveMessageCommand(commandData: MessageCommandData | MessageCommandBuilder): MessageCommandBuilder;
|
|
100
101
|
/**
|
|
101
102
|
* Is a message command builder
|
|
102
103
|
*/
|
|
@@ -179,6 +179,9 @@ class MessageCommandBuilder {
|
|
|
179
179
|
options: this.options.map(o => o.toJSON()),
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
+
static resolveMessageCommand(commandData) {
|
|
183
|
+
return this.isMessageCommandBuilder(commandData) ? commandData : new MessageCommandBuilder(commandData);
|
|
184
|
+
}
|
|
182
185
|
/**
|
|
183
186
|
* Is a message command builder
|
|
184
187
|
*/
|
|
@@ -59,10 +59,11 @@ export declare class SlashCommandBuilder extends DiscordJsSlashCommandBuilder im
|
|
|
59
59
|
* Resolve option data
|
|
60
60
|
*/
|
|
61
61
|
static resolveOption<T extends AnySlashCommandOptionBuilder>(option: AnySlashCommandOptionData): T;
|
|
62
|
+
static resolveSlashCommand(commandData: SlashCommandData | AnySlashCommandBuilder): AnySlashCommandBuilder;
|
|
62
63
|
/**
|
|
63
64
|
* Is a slash command builder
|
|
64
65
|
*/
|
|
65
|
-
static isSlashCommandBuilder(builder: unknown): builder is
|
|
66
|
+
static isSlashCommandBuilder(builder: unknown): builder is AnySlashCommandBuilder;
|
|
66
67
|
/**
|
|
67
68
|
* Is a slash command execute data
|
|
68
69
|
*/
|
|
@@ -190,6 +190,9 @@ class SlashCommandBuilder extends discord_js_1.SlashCommandBuilder {
|
|
|
190
190
|
.setNameLocalizations((_f = option.nameLocalizations) !== null && _f !== void 0 ? _f : null)
|
|
191
191
|
.setDescriptionLocalizations((_g = option.descriptionLocalizations) !== null && _g !== void 0 ? _g : null);
|
|
192
192
|
}
|
|
193
|
+
static resolveSlashCommand(commandData) {
|
|
194
|
+
return this.isSlashCommandBuilder(commandData) ? commandData : new SlashCommandBuilder(commandData);
|
|
195
|
+
}
|
|
193
196
|
/**
|
|
194
197
|
* Is a slash command builder
|
|
195
198
|
*/
|
package/bin/reciple/modules.js
CHANGED
|
@@ -55,10 +55,10 @@ function getModules(client, folder) {
|
|
|
55
55
|
if (module_.commands) {
|
|
56
56
|
for (const command of module_.commands) {
|
|
57
57
|
if (command.type === builders_1.CommandBuilderType.MessageCommand) {
|
|
58
|
-
commands.push(MessageCommandBuilder_1.MessageCommandBuilder.
|
|
58
|
+
commands.push(MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(command));
|
|
59
59
|
}
|
|
60
60
|
else if (command.type === builders_1.CommandBuilderType.SlashCommand) {
|
|
61
|
-
commands.push(SlashCommandBuilder_1.SlashCommandBuilder.
|
|
61
|
+
commands.push(SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(command));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -104,7 +104,7 @@ export interface SharedCommandDataProperties {
|
|
|
104
104
|
/**
|
|
105
105
|
* Slash command object data interface
|
|
106
106
|
*/
|
|
107
|
-
export interface SlashCommandData extends SharedCommandDataProperties, Omit<SharedCommandBuilderProperties, "setCooldown" | "setRequiredBotPermissions" | "setRequiredMemberPermissions" | "setHalt" | "setExecute" | "halt" | "execute"
|
|
107
|
+
export interface SlashCommandData extends SharedCommandDataProperties, Partial<Omit<SharedCommandBuilderProperties, "setCooldown" | "setRequiredBotPermissions" | "setRequiredMemberPermissions" | "setHalt" | "setExecute" | "halt" | "execute">> {
|
|
108
108
|
type: CommandBuilderType.SlashCommand;
|
|
109
109
|
nameLocalizations?: LocalizationMap;
|
|
110
110
|
descriptionLocalizations?: LocalizationMap;
|
|
@@ -179,12 +179,12 @@ export interface SlashCommandSubCommandData extends SharedCommandDataProperties,
|
|
|
179
179
|
type: ApplicationCommandOptionType.Subcommand;
|
|
180
180
|
options: (AnySlashCommandOptionsOnlyOptionData | AnySlashCommandOptionsOnlyOptionBuilder)[];
|
|
181
181
|
}
|
|
182
|
-
export interface MessageCommandData extends SharedCommandDataProperties, Omit<SharedCommandBuilderProperties, "setCooldown" | "setRequiredBotPermissions" | "setRequiredMemberPermissions" | "setHalt" | "setExecute" | "halt" | "execute"
|
|
182
|
+
export interface MessageCommandData extends SharedCommandDataProperties, Partial<Omit<SharedCommandBuilderProperties, "setCooldown" | "setRequiredBotPermissions" | "setRequiredMemberPermissions" | "setHalt" | "setExecute" | "halt" | "execute">> {
|
|
183
183
|
type: CommandBuilderType.MessageCommand;
|
|
184
|
-
aliases
|
|
185
|
-
validateOptions
|
|
186
|
-
allowExecuteInDM
|
|
187
|
-
allowExecuteByBots
|
|
184
|
+
aliases?: string[];
|
|
185
|
+
validateOptions?: boolean;
|
|
186
|
+
allowExecuteInDM?: boolean;
|
|
187
|
+
allowExecuteByBots?: boolean;
|
|
188
188
|
halt?: MessageCommandHaltFunction;
|
|
189
189
|
execute: MessageCommandExecuteFunction;
|
|
190
190
|
options: MessageCommandOptionResolvable[];
|