Why channel.setParent may produce DiscordAPIError[50013]: Missing Permissions when the permissions are seemingly set?
Here's the deal: in a command interaction handler, I've successfully created a channel like this:
const channel = await interaction.guild.channels.create({
name: 'new-channel',
type: ChannelType.GuildText,
// parent: categoryId,
})
if I uncomment setting parent, this also works. Now I'm trying to change the parent via
await channel.setParent(categoryId)
I'm getting the error [50013]: Missing Permissions (more details below). I was under an impression that it is ManageChannels permission that I need, so I've checked:
console.log('ManageChannels:',interaction.guild.members.me.permissions.has('ManageChannels'))
console.log('overwrites:',channel.permissionOverwrites.cache.get('ManageChannels'))
console.log('ManageChannels in role:',interaction.guild.members.me.roles.highest.permissions.has('ManageChannels'))
and got
ManageChannels: true
overwrites: undefined
ManageChannels in role: true
I've also check manually that there's no channel permissions overwrites anyway. So how comes I'm still getting this error? Due to Discord limit, I'll add error full text in comments.