From 0963ab28e041599babcfa7b67c4102b9d4e21e76 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Wed, 15 Jun 2022 12:41:02 +0700 Subject: [PATCH] fix(searchInteraction): Support enums --- src/structures/Guild.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/structures/Guild.js b/src/structures/Guild.js index 41fc589..f72dd56 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -34,6 +34,7 @@ const { PremiumTiers, Opcodes, Events, + ApplicationCommandTypes, } = require('../util/Constants'); const DataResolver = require('../util/DataResolver'); const SnowflakeUtil = require('../util/SnowflakeUtil'); @@ -655,7 +656,13 @@ class Guild extends AnonymousGuild { clearTimeout(timeout); this.client.removeListener(Events.GUILD_APPLICATION_COMMANDS_UPDATE, handler); this.client.decrementMaxListeners(); - resolve(this.client.users.cache.get(botId)?.applications?.cache?.find(c => c.name === query && c.type == type)); + resolve( + this.client.users.cache + .get(botId) + ?.applications?.cache?.find( + c => (c.name === query && c.type == type) || c.type == ApplicationCommandTypes[type], + ), + ); }; const timeout = setTimeout(() => { this.client.removeListener(Events.GUILD_APPLICATION_COMMANDS_UPDATE, handler);