𝐒𝐥𝐨𝐰𝐑𝐢𝐬𝐞
DIAdiscord.js - Imagine an app
•Created by Axodouble on 2/3/2024 in #djs-questions
Setting permission overwrite value to null.
i just wanted to help 😢
9 replies
DIAdiscord.js - Imagine an app
•Created by Axodouble on 2/3/2024 in #djs-questions
Setting permission overwrite value to null.
@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.');
}
9 replies