mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-18 15:00:00 +00:00
transform to array before filtering
This commit is contained in:
parent
3537305c59
commit
a11c39cd0a
1 changed files with 6 additions and 10 deletions
|
@ -46,11 +46,9 @@ export const VcmoveCmd = utilityCmd({
|
||||||
channel = potentialChannel;
|
channel = potentialChannel;
|
||||||
} else {
|
} else {
|
||||||
// Search string -> find closest matching voice channel name
|
// Search string -> find closest matching voice channel name
|
||||||
const voiceChannels = [
|
const voiceChannels = [...pluginData.guild.channels.cache.values()].filter(
|
||||||
...pluginData.guild.channels.cache
|
(c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE,
|
||||||
.filter((c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE)
|
);
|
||||||
.values(),
|
|
||||||
];
|
|
||||||
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name);
|
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name);
|
||||||
if (!closestMatch) {
|
if (!closestMatch) {
|
||||||
sendErrorMessage(pluginData, msg.channel, "No matching voice channels");
|
sendErrorMessage(pluginData, msg.channel, "No matching voice channels");
|
||||||
|
@ -127,11 +125,9 @@ export const VcmoveAllCmd = utilityCmd({
|
||||||
channel = potentialChannel;
|
channel = potentialChannel;
|
||||||
} else {
|
} else {
|
||||||
// Search string -> find closest matching voice channel name
|
// Search string -> find closest matching voice channel name
|
||||||
const voiceChannels = [
|
const voiceChannels = [...pluginData.guild.channels.cache.values()].filter(
|
||||||
...pluginData.guild.channels.cache
|
(c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE,
|
||||||
.filter((c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE)
|
);
|
||||||
.values(),
|
|
||||||
];
|
|
||||||
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name);
|
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name);
|
||||||
if (!closestMatch) {
|
if (!closestMatch) {
|
||||||
sendErrorMessage(pluginData, msg.channel, "No matching voice channels");
|
sendErrorMessage(pluginData, msg.channel, "No matching voice channels");
|
||||||
|
|
Loading…
Add table
Reference in a new issue