mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-10 04:01:37 +02:00
Require user to be in voice channel
This commit is contained in:
parent
362ce89987
commit
4659717e5f
12 changed files with 42 additions and 9 deletions
|
@ -1,4 +1,16 @@
|
|||
import {Guild, VoiceChannel} from 'discord.js';
|
||||
import {Guild, VoiceChannel, User} from 'discord.js';
|
||||
|
||||
export const isUserInVoice = (guild: Guild, user: User): boolean => {
|
||||
let inVoice = false;
|
||||
|
||||
guild.channels.cache.filter(channel => channel.type === 'voice').forEach(channel => {
|
||||
if (channel.members.array().find(member => member.id === user.id)) {
|
||||
inVoice = true;
|
||||
}
|
||||
});
|
||||
|
||||
return inVoice;
|
||||
};
|
||||
|
||||
export const getSizeWithoutBots = (channel: VoiceChannel): number => channel.members.array().reduce((s, member) => {
|
||||
if (!member.user.bot) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue