Creating a Discord bot requires a token to run your application. Here’s a quick guide on how to get token for your discord application:
Sign Up for Discord and Create a Test Server
Sign up for a free account on their website and download one of their desktop or mobile applications, or use it in the browser.
Once you have an account, ensure you have your own Discord server to test your bot.
You can create a new server specifically for this purpose.
Create discord bot application on discord developer portal
If you already have a Discord server, you can proceed to create a Discord application in the Discord Developer Portal.
Name your application as per your preference, this name will not be visible on the Discord server.
Within the general information section, set up the details of your application project. Note that these details differ from how the bot appears in the server.
Get the Token
Next, add a bot to the application via the ‘Bot’ tab. You can name it and change its picture as you wish.
You can obtain the bot’s token by clicking ‘Reset Token’ and then ‘Copy’. Be cautious not to share this token with anyone, as you will likely use it in your application.
Scroll down and enable the ‘SERVER MEMBERS INTENT’ in the bot’s settings. This allows the bot to receive events such as messages from a user. Check the bottom of this articles to learn about Discord Specific Terms listed here.
Invite your bot to the server
To invite your bot to the server, go to the OAuth2 URL generator and select ‘bot’. Scroll down and tick the permissions checkboxes that apply to your bot. This depends on the functionality of your bot, but for bots primarily receiving and sending messages, the settings below should suffice.
You will see a URL at the bottom of the page. Copy this link and paste it into your browser.
You will then see a request for authorization. Select the Discord server where you want to test the bot.
Congratulations! Your bot should now be visible on your server, ready for you to start developing in your application.
Explanations of Discord Specific Terms
Intents: These are like permissions that a bot has on Discord. They define what kind of information a bot can access. Presence Intent: Lets your bot know when a user’s status changes (like online, offline, playing a game, etc.) Server Members Intent: Allows your bot to get information about server members (like roles, nicknames, etc.) Message Content Intent: Lets your bot see the content of messages. Privileged Intents: These are special types of Intents (Presence, Server Members, and Message Content) that require permission to use because they can access sensitive information.
Comments