transform to array before filtering

This commit is contained in:
almeidx 2021-08-04 21:02:12 +01:00
parent 3537305c59
commit a11c39cd0a
No known key found for this signature in database
GPG key ID: 8558FBFF849BD664

View file

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