(Optimized?) voice kicking on spink

This commit is contained in:
Histmy 2021-07-10 22:53:51 +02:00
parent 5fd14f4043
commit 2d9a2f6738

View File

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