bwmarrin / discordgo

(Golang) Go bindings for Discord
BSD 3-Clause "New" or "Revised" License
5.05k stars 802 forks source link

Missing Access 50001 for GuildMembers (out of nowhere) #820

Open Southclaws opened 4 years ago

Southclaws commented 4 years ago

Hey! Weird issue, probably not relevant to this codebase but it might be an API change.

The bot was running fine the day before, no code changes, no role changes (bot has all permissions anyway) and today, the call to GuildMembers(app.config.GuildID, "", 1000) just fails with "Missing Access". So after much discussion we came to the conclusion that the API changed on Discord's side.

Maybe something that needs to be updated here or something, or maybe it's a problem with an outdated usage of this function.

Here's the code anyway: https://github.com/Southclaws/cj/commit/6d9b89f79f40fcd12fb5029a9aa20b2465d9fa2f#diff-64ac3a5b7562d64a02d374d29eef9b49L163 we removed it because we had to.

samuel-hunter commented 4 years ago

Hi! I've recently had a similar problem the same day this issue was made, and I've been following this in hopes that there's progress. My own personal bot errors with "Missing Access", and then segfaults on a different event later on.

If I have time, I should plan to make a minimum-code bot to highlight the error.

SonarBeserk commented 3 years ago

@Southclaws @samuel-hunter I determined based on the notice in the api docs https://discord.com/developers/docs/resources/guild#list-guild-members and reviewing the bot section of the discord developer portal that they have put the server intent in place.

Server Members Intent

If your bot tracks server members or downloads the entire member list, you may need the server members intent to receive member events and the member list.

NOTE: Once your bot reaches 100 or more servers, this will require Verification and whitelisting. Read more here

If you enable this option the error no longer occurs

chand1012 commented 3 years ago

Was having the exact same issue, changed the setting mentioned by @SonarBeserk and it worked! The option is on the bot page of the Discord Developer Panel. Its about halfway down, under "Privileged Gateway Intents".

image

Edit: Fixed my grammar.

Taycenn commented 2 years ago

Can someone help me with a code error? I have this code error in my console:

discord-bot@1.0.0 deployCommands node src/deploy-commands.js

S[50001]: Missing Access at Q.runRequest (/home/taycen/Schreibtisch/Discord-Bot/node_modules/@discordjs/rest/dist/index.js:7:581) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Q.queueRequest (/home/taycen/Schreibtisch/Discord-Bot/node_modules/@discordjs/rest/dist/index.js:5:2942) { rawError: { message: 'Missing Access', code: 50001 }, code: 50001, status: 403, method: 'put', url: 'https://discord.com/api/v9/applications/946831446071447612/guilds/932997267483418704/commands', requestBody: { files: undefined, json: [] } }

I have no idea what it could be, hope someone can help me. Sincerely, Taycen

FedorLap2006 commented 2 years ago

Not sure if this is related to DiscordGo, it looks like Discord.JS code. But from what I can tell, probably you just need to re-invite the bot with applications.commands oauth2 scope.

Robinnnnn commented 2 years ago

This began occurring for us once we updated the channel permissions that the bot was in! Hope this helps anyone else.