DEV Community

Cover image for Permission Error - Discord.js
EnderBombz
EnderBombz

Posted on

1

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 😁

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (1)

Collapse
 
thomasbnt profile image
Thomas Bnt

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

nextjs tutorial video

Youtube Tutorial Series

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay