NevergonnagiveuupL
NevergonnagiveuupL

Reputation: 60

Can you use the Discord API to get what servers the bot is in, and How?

Im trying to make a discord dashboard all out of Pure HTML (Includes JS, CSS just to be clear), and I wanted to get a list of all the guilds the bot is in without any other APIs like discord.py or discord.js. How can I do this? I couldn't find anything on the Discord Developer Documentation, and is it even possible?

I've tried some answers like getting '/users/@me/guilds', but it just returns the current person that is logged in with the bot's guilds, and not what the bot has joined.

Thanks.

Upvotes: 2

Views: 1092

Answers (1)

Koll
Koll

Reputation: 142

You should make an HTTP requests with your bot's token:

URL: https://discord.com/api/v9/users/@me/guilds
HEADERS: Authorization: "Bot TOKEN"

It will return a JSON with all the guilds your bot is in. But make sure you don't leak your bot's token somewhere in JS or HTML files. I guess this should work, have a good day! :D

Upvotes: 1

Related Questions