From 73de6dbcecb344facb79724ef9141f341ecd84c7 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Fri, 9 Feb 2024 16:30:58 +0100 Subject: [PATCH] bugfix: simple logic patches --- events/channels/channelDelete.js | 6 ++++-- events/channels/voiceStateUpdate.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/events/channels/channelDelete.js b/events/channels/channelDelete.js index b3494b5..78e253f 100644 --- a/events/channels/channelDelete.js +++ b/events/channels/channelDelete.js @@ -1,13 +1,15 @@ -import { Events } from 'discord.js'; +import { ChannelType, Events } from 'discord.js'; import { VoiceChannel } from '../../database.js'; export const name = Events.ChannelDelete; export async function execute(channel) { + if (channel.type !== ChannelType.GuildVoice) return; + // Delete channel entry once channel is deleted itself const count = await VoiceChannel.destroy({ where: { id: channel.id } }); - if (count > 0) console.info(`[INFO] Custom VC with ID '${channel.id}' was deleted.`); + if (count > 0) console.info(`[INFO] Custom VC entry with ID '${channel.id}' was destroyed.`); } diff --git a/events/channels/voiceStateUpdate.js b/events/channels/voiceStateUpdate.js index 616349d..3b6b614 100644 --- a/events/channels/voiceStateUpdate.js +++ b/events/channels/voiceStateUpdate.js @@ -11,7 +11,6 @@ const vcPermissionOverwrites = [ PermissionFlagsBits.ViewChannel, PermissionFlagsBits.MuteMembers, PermissionFlagsBits.MoveMembers, - PermissionFlagsBits.ManageRoles, PermissionFlagsBits.Connect, PermissionFlagsBits.Stream, PermissionFlagsBits.UseVAD, @@ -78,7 +77,8 @@ const leftVoiceChat = async (state) => { export const name = Events.VoiceStateUpdate; export async function execute(oldState, newState) { - if (!newState.channel) return await leftVoiceChat(oldState); + await leftVoiceChat(oldState) + if (!newState.channel) return; // Find channel by id, return if not registered for customs const createCh = await VoiceChannel.findOne({