DEV Community

Cover image for Permission Error - Discord.js
EnderBombz
EnderBombz

Posted on

 

Permission Error - Discord.js

DiscordAPIError[50013]: Missing Permissions

Hello guys, what's up? this is my first post in this community 😃, but i'm with a trouble and i find this site, i'm with a little problem about "permissions" of my discord bot, i gave Administrator permission for bot, but every time when i finish the request to give role with a interactive button, he return this error:

Image description

I'm using a instance of client class of Discord.js like this:

...
 getClient() {
        const client: any = new Client({ intents: GatewayIntentBits.Guilds });
        client.commands = new Collection();
        client.commandArray = [];
        return client
    }
...
Enter fullscreen mode Exit fullscreen mode

But the problem is happening in this line:

const guild = client.guilds.cache.get("1032496332306403409");
                const member = guild.members.cache.get(interaction.user.id)
                member.roles.add("1032639462938787880");
Enter fullscreen mode Exit fullscreen mode

I tried to change role of bot, or re-invite for the server with ALL cargos and with all scopes, not is happening...

If anyone have another better way to change the role of a person or make this line works, i will feel very hapiness 😁

Latest comments (1)

Collapse
 
thomasbnt profile image
Thomas Bnt

Hello, maybe you don't have the right Intents 🤔

Need a better mental model for async/await?

Check out this classic DEV post on the subject.

⭐️🎀 JavaScript Visualized: Promises & Async/Await

async await