I'm trying to fetch the member list of a discord server. The Discord bot is inside the server and has admin permission. I'm referring to this part of the documentation Discord Docs.
const response = await fetch(`https://discord.com/api/guilds/685509789178003502/members`, {
headers: {
Authorization: `Bot ${botToken}`
}
})
var currentUser = await response.json()
This is the response I'm getting
{"message":"Missing Access","code":50001}
I checked it like a million times and the bot has admin perms 100%.
Enable Members Intent
Further Reading: https://gist.github.com/advaith1/e69bcc1cdd6d0087322734451f15aa2f