Eros
Eros

Reputation: 21

UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions

Example code:

let roles = JSON.parse(result[0].roles);
if ( roles[ 'onJoinEvent' ] && roles[ 'onJoinEvent' ][ 'status' ] == "true" )
{
    console.log(roles[ 'onJoinEvent' ])
    roles[ 'onJoinEvent' ][ 'roles' ].forEach( async function(element)
    {
        let lol = member.guild.roles.find( rol => rol.id == element );
        if (lol) member.addRole(lol.id);
    })
}

It has administrator permission, so. : https://i.sstatic.net/0NCrk.png

Evidence of error : https://i.sstatic.net/LEDE0.png

If you want to see my db -> : https://i.sstatic.net/E0Ziz.png

Upvotes: 0

Views: 1259

Answers (1)

Humboldt123
Humboldt123

Reputation: 725

The bot's invite link is what determines its permissions. In this case, your invite link is faulty and does not have the needed administrator permissions. You have to kick the bot and re-invite it with the link of https://discordapp.com/oauth2/authorize?client_id=INSERT_CLIENT_ID_HERE&scope=bot&permissions=8.

Upvotes: 1

Related Questions