Reputation: 1
For my parent category, the perms are set to everyone cannot connect to channels created and I want it so when someone reacts to the ✅, the bot allows anyone to join the voice channel. The code creates no errors but the permissions do not change. Does anyone know why?
Here is my code:
if(reaction.emoji.name === '✅') {
message.channel.overwritePermissions([
{
id: message.channel.guild.roles.everyone,
allow: ['CONNECT'],
},
]);
}
Upvotes: 0
Views: 874
Reputation: 1565
In order to update the '@everyone' role's permission overwrites, you will instead need to use message.guild.id
In addition to this, you're currently attempting to update the overwrites of a text channel
to give connect
permissions to everyone in the server which, let's be honest, does not really make much sense.
If you're trying to execute this command while the executor is present inside of a voice channel, here's what I'd suggest:
user
argument in your reactions collector, therefore you could simply use const member = reaction.guild.member(user.id)
to get the GuildMember object of the reactor.member.voice.channel
function to get the channel object of the executorAnd finally, after all of the above has been done, your code should look like this:
const member = reaction.guild.member(user.id)
const channel = member.voice.channel
channel.overwritePermissions([
{
id: message.guild.id,
allow: ['CONNECT']
}
])
Upvotes: 1