#missing permissions / permissions are already granted
32 messages · Page 1 of 1 (latest)
- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- 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!
if (
!inter.guild.members.me.permissions.has(
PermissionsBitField.Flags.ManageChannels
)
) {
return inter.reply({
content: 'missing manage channels',
ephemeral: true,
});
}
if (
!inter.guild.members.me.permissions.has(
PermissionsBitField.Flags.ManageRoles
)
) {
return inter.reply({
content: 'missing manage roles',
ephemeral: true,
});
}
try {
channel = await inter.guild.channels.create({
name: "test",
type: 0,
parent: inter.channel.parent.id,
permissionOverwrites: [
{
id: bot.user.id,
allow: [
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.EmbedLinks,
],
},
{
id: inter.guild.id,
allow: [PermissionsBitField.Flags.ViewChannel],
},
],
});
} catch (e) {
channel = await inter.guild.channels.create({
name: "test",
type: 0,
permissionOverwrites: [
{
id: bot.user.id,
allow: [
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.EmbedLinks,
],
},
{
id: inter.guild.id,
allow: [PermissionsBitField.Flags.ViewChannel],
},
],
});
return inter.reply({
content: 'unable to set parent',
ephemeral: true,
});
}```
what's the full error including stack
that's all i get
There's more below it because that last line is cropped
It should include the API path
the last line just shows the line of the code
which is this part
} catch (e) {
>>> channel = await inter.guild.channels.create({
the error stops there
Your bot is missing one of the three permissions you try to add as allow overwrite there. Your bot can’t allow itself a permission it doesn’t already have
i got the extra part
Does it have them globally though? console.log(inter.guild.members.me.permissions) please
PermissionsBitField { bitfield: 1808015873801975n }
?
And that’s on the same guild the error comes from?
yes
Can you console.log the error you catch too please?
Wait. But this had a parent_id in it too. But you literally catch that error and then try to create without parent_id. So does that succeed?
console.log(inter.guild.members.me.permissionsIn('841311039462572053') then
it creates the channel, but it does not set the permissions
i take that back, it succeeds
You said the error you got referenced this line, which is the one creating without parent id. Yet your error details show the parent id. This doesn’t add up. What is it?
the parent seems to be the issue
👆
PermissionsBitField { bitfield: 1808015873800951n }
Yup, your bot is missing ViewChannel permissions on that
That’s why it can‘t grant that permission to anyone (including itself) to a child of that category
alright, is there any way i can simplify that bitfield into permission names, for better understanding on my end?