Setting permission overwrite value to null.

Running into an odd issue, simply put:
vc.permissionOverwrites.edit(interaction.guild.id, {Connect: null,});
vc.permissionOverwrites.edit(interaction.guild.id, {Connect: null,});
This ignores setting the connect value to not have a specific override anymore, is there any other way to fix this? My assumption is that it assumes that if different values are null that they should not be altered, however now the issue is that I do not want to set the value to true or to false but instead to remove that specific permission overwrite on that permission. Any ideas on how I could achieve this?
5 Replies
d.js toolkit
d.js toolkit10mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Axodouble
AxodoubleOP10mo ago
Discord.JS ver. [email protected] The difference is that I want it to specifically not need to redefine everything else and instead of needing to redefine everything manually for every instance, to be able to just change this one tag or one permission override to be neutral again. Is there any way to delete the entire override and just copy the entire override and then just leave only the connect as null?
d.js docs
d.js docs10mo ago
:method: PermissionOverwrites#edit() Edits this Permission Overwrite.
𝐒𝐥𝐨𝐰𝐑𝐢𝐬𝐞
@Qjuh idk if this works but here const guildId = interaction.guild.id; const voiceChannel = interaction.guild.channels.cache.find(channel => channel.type === 'GUILD_VOICE' && channel.permissionsFor(guildId).has('CONNECT')); if (voiceChannel) { const permissions = voiceChannel.permissionOverwrites.get(guildId) || { id: guildId, allow: [], deny: [] }; // Modify the permissions as needed permissions.allow.push('CONNECT'); permissions.deny = permissions.deny.filter(permission => permission !== 'CONNECT'); await voiceChannel.permissionOverwrites.edit(guildId, permissions) .then(() => console.log('Voice channel permissions updated successfully.')) .catch(error => console.error('Error updating permissions:', error)); } else { console.error('Voice channel not found.'); } i just wanted to help 😢
Axodouble
AxodoubleOP10mo ago
Was able to get it working on a newer vers. of DJS, where setting it to Null will make it inbetween true and false.
Want results from more Discord servers?
Add your server