Skip to content

Creating and adding a bot

Sparker edited this page Apr 30, 2020 · 7 revisions

Creating a bot in discord is stupid easy. First you need to go to here and click "New Application" Application Screen

Now give your bot a name and click create. New Application Screen

On the new Screen you will be able to change your bot profile image, bot descriptions and many more details. Click "Bot" on the left sidebar. Then click "Add Bot". Screen you see after creating a new application then scrolling down a little. Yes Do It.

Now you can get your bot's token by using the "Click to Reveal Token" button under your bot username or simply click "Copy" and token will be copied to your clipboard directly. New Bot Page

Now it's time to invite your bot to your server. Don't worry about the bot being up and running for this next step. Replace YOUR_CLIENT_ID_HERE in this URL https://discordapp.com/oauth2/authorize?&client_id=YOUR_CLIENT_ID_HERE&scope=bot&permissions=0 with the Client ID from the "General Information" tab. Wheres my Client ID

Then paste the link into your browser. It will give you a page that looks like this: Authorize Bot

Now select your server in the dropdown, then click "Authorize". Authorized

Note that your bot will connect to your server but it wont have specific permissions. If you want to create an automatic role, go to "Bot" tab in your bot settings page and scroll down. Select your desired permissions and copy the result number to the final part of the URL you used before (the one you copied and pasted your Client ID inside) Authorized

That's it! Now you can start your bot and enjoy chatting!

IMPORTANT: you should NEVER give your bot's token to anybody you do not trust, and never EVER under any circumstances push it to a public Git repo where everyone can see it. The token gives you full access to your bot account's permissions, so if somebody gains access to it maliciously they could do any number of bad things with the bot -- this includes leaving all of its guilds (servers), spamming unfavorable links or messages in text channels, deleting messages/channels in guilds where it has moderator permissions, and other nasty stuff along those lines. Keep it a secret!
However, if your token ever does get compromised or you suspect it has been, the very first thing you should do is go to its Discord Apps page, then "Bot" tab on the left sidebar and then click "Regenerate" and "Yes, do it!" in the confirmation dialog. This will give you a unique, brand-new token that you can update your bot's code with.
"Generate a new token?" link. The token is fake, don't worry.
Confirmation dialog for generating new token Afterwards, take the appropriate measures to place this new token in a secure place where it can't be leaked or compromised again. If you would like to open-source your bot's code without disclosing its token, you can store the token in a separate file (which your bot can load the token from), then add this file to .gitignore to ensure that it isn't published along with the rest of your bot.
Good luck!

Clone this wiki locally