From 8e9ddb1e7bee1ef705256eb182eff7039224d8b5 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Thu, 8 Feb 2024 00:21:53 +0100 Subject: [PATCH] explicit permission overwrites --- events/channels/voiceStateUpdate.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/events/channels/voiceStateUpdate.js b/events/channels/voiceStateUpdate.js index 8b33a89..af4c852 100644 --- a/events/channels/voiceStateUpdate.js +++ b/events/channels/voiceStateUpdate.js @@ -1,6 +1,24 @@ -import { ChannelType, Events, PermissionsBitField } from 'discord.js'; +import { ChannelType, Events, PermissionFlagsBits } from 'discord.js'; import { VoiceChannel } from '../../database.js'; +const vcPermissionOverwrites = [ + PermissionFlagsBits.ManageRoles, + PermissionFlagsBits.ManageChannels, + PermissionFlagsBits.ViewChannel, + PermissionFlagsBits.ModerateMembers, + PermissionFlagsBits.SendMessages, + PermissionFlagsBits.SendMessagesInThreads, + PermissionFlagsBits.ManageMessages, + PermissionFlagsBits.ReadMessageHistory, + PermissionFlagsBits.AddReactions, + PermissionFlagsBits.Connect, + PermissionFlagsBits.Speak, + PermissionFlagsBits.MuteMembers, + PermissionFlagsBits.DeafenMembers, + PermissionFlagsBits.MoveMembers, + PermissionFlagsBits.UseVAD +]; + const getchannel = async (member, channels) => { // Check database for existing channel const ownCh = await VoiceChannel.findOne({ @@ -21,9 +39,7 @@ const getchannel = async (member, channels) => { permissionOverwrites: [ { id: member.id, - allow: [ - PermissionsBitField.All - ] + allow: vcPermissionOverwrites } ] });