From a11c39cd0a4bcd5ef915c02bc7957f6bdbd5b75a Mon Sep 17 00:00:00 2001 From: almeidx Date: Wed, 4 Aug 2021 21:02:12 +0100 Subject: [PATCH] transform to array before filtering --- .../src/plugins/Utility/commands/VcmoveCmd.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/backend/src/plugins/Utility/commands/VcmoveCmd.ts b/backend/src/plugins/Utility/commands/VcmoveCmd.ts index 409918dd..f2feb8ef 100644 --- a/backend/src/plugins/Utility/commands/VcmoveCmd.ts +++ b/backend/src/plugins/Utility/commands/VcmoveCmd.ts @@ -46,11 +46,9 @@ export const VcmoveCmd = utilityCmd({ channel = potentialChannel; } else { // Search string -> find closest matching voice channel name - const voiceChannels = [ - ...pluginData.guild.channels.cache - .filter((c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE) - .values(), - ]; + const voiceChannels = [...pluginData.guild.channels.cache.values()].filter( + (c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE, + ); const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name); if (!closestMatch) { sendErrorMessage(pluginData, msg.channel, "No matching voice channels"); @@ -127,11 +125,9 @@ export const VcmoveAllCmd = utilityCmd({ channel = potentialChannel; } else { // Search string -> find closest matching voice channel name - const voiceChannels = [ - ...pluginData.guild.channels.cache - .filter((c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE) - .values(), - ]; + const voiceChannels = [...pluginData.guild.channels.cache.values()].filter( + (c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE, + ); const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name); if (!closestMatch) { sendErrorMessage(pluginData, msg.channel, "No matching voice channels");