From bb51132bdb2aa8ec032ec6cf07ec73ee1820ca42 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Thu, 16 Jun 2022 17:41:42 +0700 Subject: [PATCH] fix(TextBasedChannel): Search Slashcommand wrong --- src/structures/interfaces/TextBasedChannel.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/structures/interfaces/TextBasedChannel.js b/src/structures/interfaces/TextBasedChannel.js index 6c95e90..fea446e 100644 --- a/src/structures/interfaces/TextBasedChannel.js +++ b/src/structures/interfaces/TextBasedChannel.js @@ -413,18 +413,25 @@ class TextBasedChannel { type: 1, // CHAT_INPUT, include_applications: false, query: commandName, - limit: 25, + limit: 25, // Max // Shet // application_id: botId, }, }); for (const command of data.application_commands) { if (user.id == command.application_id) { - commandTarget = user.applications._add(command, true); + const c = user.applications._add(command, true); + if (command.name == commandName) commandTarget = c; + } else { + const tempUser = this.client.users.cache.get(command.application_id); + if (tempUser && tempUser.bot && tempUser.applications) { + tempUser.applications._add(command, true); + } } } // Remove - // commandTarget = user.applications.cache.find(c => c.name === commandName && c.type === 'CHAT_INPUT'); + commandTarget = + commandTarget || user.applications.cache.find(c => c.name === commandName && c.type === 'CHAT_INPUT'); if (!commandTarget) { throw new Error( 'INTERACTION_SEND_FAILURE',