aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2021-11-17 16:16:00 -0500
committerMax Isom <[email protected]>2021-11-17 16:16:00 -0500
commitdd81fc47fd3810da2c977eb4164f09bc2151e0b2 (patch)
treececf621652600d2f1930774b8f17b3d83e104b2d /src/utils
parentdefb56ed5ec606da90557753f53ab66844e94843 (diff)
parent41b050a2f1fe4e2cb94629e2add1b490a69a2004 (diff)
downloadmuse-dd81fc47fd3810da2c977eb4164f09bc2151e0b2.tar.xz
muse-dd81fc47fd3810da2c977eb4164f09bc2151e0b2.zip
Merge branch 'master' into bugfix/only-add-listeners-once
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/channels.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/utils/channels.ts b/src/utils/channels.ts
index 4c5b6b0..2d074b4 100644
--- a/src/utils/channels.ts
+++ b/src/utils/channels.ts
@@ -3,8 +3,8 @@ import {Guild, VoiceChannel, User, GuildMember} 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)) {
+ guild.channels.cache.filter(channel => channel.type === 'GUILD_VOICE').forEach(channel => {
+ if ((channel as VoiceChannel).members.find(member => member.id === user.id)) {
inVoice = true;
}
});
@@ -12,7 +12,7 @@ export const isUserInVoice = (guild: Guild, user: User): boolean => {
return inVoice;
};
-export const getSizeWithoutBots = (channel: VoiceChannel): number => channel.members.array().reduce((s, member) => {
+export const getSizeWithoutBots = (channel: VoiceChannel): number => channel.members.reduce((s, member) => {
if (!member.user.bot) {
s++;
}
@@ -22,7 +22,7 @@ export const getSizeWithoutBots = (channel: VoiceChannel): number => channel.mem
export const getMemberVoiceChannel = (member?: GuildMember): [VoiceChannel, number] | null => {
const channel = member?.voice?.channel;
- if (channel && channel.type === 'voice') {
+ if (channel && channel.type === 'GUILD_VOICE') {
return [
channel,
getSizeWithoutBots(channel),
@@ -41,7 +41,7 @@ export const getMostPopularVoiceChannel = (guild: Guild): [VoiceChannel, number]
const voiceChannels: PopularResult[] = [];
for (const [_, channel] of guild.channels.cache) {
- if (channel.type === 'voice') {
+ if (channel.type === 'GUILD_VOICE') {
const size = getSizeWithoutBots(channel as VoiceChannel);
voiceChannels.push({