darkhorse
darkhorse

Reputation: 8782

Get all the servers my bot is on using Discord API

I have a Discord bot added to a few servers/guilds. I'm able to get a specific guild using the resources available here: https://discord.com/developers/docs/resources/guild

It's fairly simple, requiring me to send a GET request to https://discordapp.com/api/guilds/{guildID}. What I want to do is get a list of all the guilds that my bot is connected to using the API. Haven't been able to find anything referencing that in the docs. Is this possible to do?

Upvotes: 5

Views: 2688

Answers (1)

Leau
Leau

Reputation: 1074

For sure it's possible, you can directly interect with the API like this:

fetch('https://discordapp.com/api/users/@me/guilds', {
  headers: {
    'Authorization': token
  }
});

Also, you can find the documentation on https://discord.com/developers/docs/resources/user#get-current-user-guilds

Upvotes: 6

Related Questions