Require user to be in voice channel

This commit is contained in:
Max Isom 2020-03-19 17:39:55 -05:00
parent 362ce89987
commit 4659717e5f
12 changed files with 42 additions and 9 deletions

View file

@ -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) {