Help With permission on discord bot
I have already given permission for application.commands on my discord bot
https://discord.com/oauth2/authorize?client_id='myid'&permissions=xxxx&scope=bot+applications.commands
but when i try to create a channel i get the error but it does create channel and make a role for me but it
get that error and i get failed to create team
https://srcshare.io/65f55a31127daf3001d661d4
and here is the code
https://srcshare.io/65f55ab4127daf3001d661d8
4 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- 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!
- ✅
Marked as resolved by OP@Qjuh what do u mean by pass the interaction.user overwrite in the create call too
I have already passed it right ?
line 71
await teamChannel.permissionOverwrites.create(interaction.user, {
ViewChannel: true,
});
so u meant to say
const newTeamRole = await interaction.guild.roles.create({
this one and
const teamChannel = await interaction.guild.channels.create({
that ?
nop i can give permission to bot on my own right but i want only the newTeamRole.id to have access to it so i dont want my bot to be inside the channel after creation of channel
isint it already in the channels.create
const teamChannel = await interaction.guild.channels.create({
name: teamName,
type: ChannelType.GuildText,
parent: teamCategory,
permissionOverwrites: [
{
id: interaction.guild.roles.everyone, // Deny access to everyone
deny: [PermissionsBitField.Flags.ViewChannel],
},
{
id: newTeamRole.id, // Allow access to the newTeamRole
allow: [PermissionsBitField.Flags.ViewChannel],
},
],
});
which would be the easy way to get the bot inside the channel or keep it out ? @
@Qjuh i got it to work but now
if there is an exisiting team and role of the same name its crashing the bot
here is the error on log
https://srcshare.io/65f56b1c07f5041b2ea81739
here is the updated code
https://srcshare.io/65f55a31127daf3001d661d4
Now got it to work thx 🙏