fix(searchInteraction): Support enums

This commit is contained in:
March 7th 2022-06-15 12:41:02 +07:00
parent 2edf7428d8
commit 0963ab28e0

View File

@ -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);