mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
fix(plugins): createApplicationCommand validation
This commit is contained in:
@@ -92,13 +92,6 @@ export function createApplicationCommand(bot: BotWithCache) {
|
||||
|
||||
// Only slash need to be lowercase
|
||||
options.name = options.name.toLowerCase();
|
||||
} else {
|
||||
if (!CONTEXT_MENU_COMMANDS_NAME_REGEX.test(options.name)) {
|
||||
throw new Error(
|
||||
"The name of the context menu did not match the required regex.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Slash commands require description
|
||||
if (
|
||||
@@ -134,6 +127,13 @@ export function createApplicationCommand(bot: BotWithCache) {
|
||||
|
||||
options.options = validateApplicationCommandOptions(bot, options.options);
|
||||
}
|
||||
} else {
|
||||
if (!CONTEXT_MENU_COMMANDS_NAME_REGEX.test(options.name)) {
|
||||
throw new Error(
|
||||
"The name of the context menu did not match the required regex.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return await createApplicationCommandOld(options, guildId);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user