diff --git a/modules/spink.js b/modules/spink.js index c0697ce..cf009fd 100644 --- a/modules/spink.js +++ b/modules/spink.js @@ -95,14 +95,16 @@ module.exports = { if (mes.content[0] !== 's') return; const uzivatel = mes.content.match(/(?<=discord_)\d+/)?.[0]; if (!uzivatel) return; - [...mes.client.guilds.cache.values()].forEach(guild => { - [...guild.channels.cache.values()].filter(ch => ch.type === 'voice').forEach(channel => { - [...channel.members.values()].forEach(user => { - if (user.user.id !== uzivatel) return; - user.voice.kick('spinkacek'); - }); - }); - }); + for (const [_, guild] of mes.client.guilds.cache) { + for (const [_, channel] of guild.channels.cache) { + if (channel.type !== "voice") continue; + for (const [_, member] of channel.members) { + if (member.id !== uzivatel) continue; + member.voice.kick("spinkacek"); + return; + } + } + } } } };