How can I check if I can overwrite channel permissions?

I prefer to check permissions before acting. So if I want to create a channel I check
if (categoryChannel.permissionsFor(guild.members.me).has([ PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.ManageChannels ], true)) {
// ok
}
if (categoryChannel.permissionsFor(guild.members.me).has([ PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.ManageChannels ], true)) {
// ok
}
So, how can I check if I can overwrite channel permissions? In what situations might a bot not have enough perms to perform this action? What kind of bitField is needed to execute lockPermissions()?
6 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
souji
souji3y ago
you need manage roles on the channel to change permissions probably don't even need manage channels, that's name, topic, delete, slowmode, etc.
fenya
fenyaOP3y ago
thx What about embeds? What kind of perms do bot needed to send embeds? AttachFiles or EmbedLinks?
souji
souji3y ago
latter former, if you want to send an attachment with it, ofc
axiprime
axiprime3y ago
on your channel edit, put lockpermission : true channel.permissionoverwrite.edit(( lockpermission : true, permissions: [the permissions] ))
fenya
fenyaOP3y ago
thx
Want results from more Discord servers?
Add your server