I'm using Discord OAuth2 for my discord bot dashboard. I retrieve the user's servers by the link https://discord.com/api/users/@me/guilds. I want to prompt the user to add my bot to his guild or go directly to the dashboard if the bot is already in the user's guild. But how do I know if the bot is already in a guild? I didn't find any API that does this.
Find your Guild ID (Server ID)In Discord, open your User Settings by clicking the Settings Cog next to your user name on the bottom. Go to Appearance and enable Developer Mode under the Advanced section, then close User Settings. Open your Discord server, right-click on the server name, then select Copy ID.
Getting an OAuth2 URLOpen your Discord applications open in new window, create or select an application, and head over to the "OAuth2" page. Once you've added your redirect URL, you will want to generate an OAuth2 URL. Lower down on the page, you can conveniently find an OAuth2 URL Generator provided by Discord.
Guilds in Discord represent an isolated collection of users and channels, and are often referred to as "servers" in the UI.
In order to join the Official Discord server, you will need to go to your profile settings and then scroll down. You will see an option that says "Add Discord".
It's an API request per guild, but you could use get guild member with your own bot's ID; if you get a 4xx then your bot isn't present in the guild.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With