client.application.commands.permissions.set(), 401: Unauthorized

When I try to use the client.application.commands.permissions.set() I get the 401: Unauthorized You just use the bot token right? or do you have to use the application secret but i still get the error then. What am I doing wrong?
10 Replies
d.js toolkit
d.js toolkit2d ago
- 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!
Ypsilon
YpsilonOP2d ago
Are the scopes the app has.
No description
Syjalo
Syjalo2d ago
You should use a guild id and OAuth2 token of the guild admin
Ypsilon
YpsilonOP2d ago
Well needing an Oauth token for this complicates stuff 😅
NyR
NyR2d ago
Well you can add default_member_permissions for commands, but if you need to add channel/member level permission override. Then you'll have to go through oauth
Ypsilon
YpsilonOP2d ago
I want to use role permissions
await client.application.commands.permissions.set({
guild: GUILD_ID,
command: pingCommand,
permissions: [
{
id: ROLE_CITIZEN,
type: ApplicationCommandPermissionType.Role,
permission: true,
},
],
token: token,
})
await client.application.commands.permissions.set({
guild: GUILD_ID,
command: pingCommand,
permissions: [
{
id: ROLE_CITIZEN,
type: ApplicationCommandPermissionType.Role,
permission: true,
},
],
token: token,
})
NyR
NyR2d ago
Yeah then without oauth2, you can't
Ypsilon
YpsilonOP2d ago
:sadge: It looks like it really needs to be the owners oauth? because I just try with my token and still got 401 and I am administrator on the guild
Syjalo
Syjalo2d ago
Server admins can manage permissions in Server settings > Integrations > The bot > Commands > Permissions
Ypsilon
YpsilonOP2d ago
Not really just did it manually but would have been nice, because 80% don't understand how the command system works. The disabled all commands in the @everyone role. So nobody could use a single application 😅

Did you find this page helpful?