From 6417d43ced4589511889624aebb672cca11d5700 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Fri, 18 Nov 2022 19:23:43 +0700 Subject: [PATCH] feat: Slash command with localized name --- src/structures/ApplicationCommand.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/structures/ApplicationCommand.js b/src/structures/ApplicationCommand.js index 5ca66a8..6061714 100644 --- a/src/structures/ApplicationCommand.js +++ b/src/structures/ApplicationCommand.js @@ -742,7 +742,9 @@ class ApplicationCommand extends Base { }; const parseSubCommand = async (subCommandName, options, subGroup) => { const options_sub = subGroup ? subGroup.options : this.options; - const subCommand = options_sub.find(o => o.name == subCommandName && o.type == 'SUB_COMMAND'); + const subCommand = options_sub.find( + o => (o.name == subCommandName || o.nameLocalized == subCommandName) && o.type == 'SUB_COMMAND', + ); if (!subCommand) { throw buildError( 'SubCommand', @@ -768,7 +770,9 @@ class ApplicationCommand extends Base { }; }; const parseSubGroupCommand = async (subGroupName, subName) => { - const subGroup = this.options.find(o => o.name == subGroupName && o.type == 'SUB_COMMAND_GROUP'); + const subGroup = this.options.find( + o => (o.name == subGroupName || o.nameLocalized == subGroupName) && o.type == 'SUB_COMMAND_GROUP', + ); if (!subGroup) { throw buildError( 'SubGroupCommand',