diff --git a/events/channels/voiceStateUpdate.js b/events/channels/voiceStateUpdate.js index 209a281..ae449eb 100644 --- a/events/channels/voiceStateUpdate.js +++ b/events/channels/voiceStateUpdate.js @@ -63,6 +63,15 @@ const leftVoiceChat = async (state) => { const members = Array.from(channel.members); if (members.length > 0) return; + // Find channel by id, return if not registered as custom + const custom = await VoiceChannel.findOne({ + where: { + id: channel.id, + create: false + } + }); + if (custom === null) return; + // Delete channel from guild await channel.guild.channels.delete(channel.id); console.info(`[INFO] Custom VC with ID '${channel.id}' was empty and got deleted.`); @@ -73,6 +82,18 @@ export async function execute(oldState, newState) { if (!newState.channel) return await leftVoiceChat(oldState); + console.log( + Array.from( + newState + .channel + .permissionOverwrites + .cache + .values() + ).forEach(overwrite => + console.log(overwrite.allow.toArray()) + ) + ); + // Find channel by id, return if not registered for customs const createCh = await VoiceChannel.findOne({ where: {