Download Article
A beginner-friendly guide to creating your own Discord bot
Download Article
If you run a Discord server, you can use bots to take care of repetitive tasks, greet new people in channels, keep music playing , and so much more. Creating a bot in Discord is easy, and this guide will teach you how.
Things You Should Know
- Open Discord and toggle on Developer Mode. Then, select "Discord API to create your bot application.
- Create the bot on the Developer website and copy the token.
- Click to generate a URL for the bot, then follow that URL to add the bot to your server.
Steps
Section 1 of 3:
Creating the Bot
-
Code your Bot. Download Node.js from https://nodejs.org/en/download/ if you don't have it. You'll need to program the bot to be able to use it, and Node.js is a free JavaScript runtime that you’ll need to make your bot. You can pick either the Windows or macOS installer and which version. The LTS version is recommended for this process.
- Ideally, you should have a server OS installed on your computer Windows Server , Ubuntu Server , or macOS server . You can also host your bot on Azure, AWS, or Google Cloud
-
Open Discord to "User Settings." Click the app icon that looks like a controller on a light background, or log into the web app at https://discord.com . You can do this on a Windows or Mac computer. In this section, you'll create an app that activates the bot, so you'll create an app and a bot.
- Click the gear icon to open "User Settings."
Advertisement -
Click Advanced . It's in the menu on the left side of the "User Settings" window under the "App Settings" header.
-
Click Discord API . You'll see this included in the text with "Developer Mode."
- Your browser will open to Discord's Developer Portal documents.
-
Click Applications . You'll see this in the top left corner of the page.
- Log into your Discord account again if prompted.
-
Click the blue New Application button. You’ll see this on the right side of the browser. A window will pop up for your app’s name.
- Type in the application's name, agree to the Discord Developer ToS, and click “Create.” You'll want to create a descriptive name, like "Greeterbot," if your app bot greets people. However, "Greeterbot" will most likely trigger errors later on because it's a popular name, so add a series of numbers after the name, like "Greeterbot38764165441."
-
Click Bot in the left-hand menu. This is also the jigsaw puzzle piece icon.
-
Click Add Bot . This is under the “Build-A-Bot” header.
- Click “Yes, do it!” in the pop-up to confirm your action.
- If you get an error about the name being too popular, go to the application page and change the app name. For example, “Music Bot” was too popular, so adding a few numbers to the end of the app helped.
-
Click Click to Reveal Token . You’ll see this in the information area of your bot. When you click that text, you see a string of letters and numbers.
- Click “Copy” to copy all that text. You can paste it on a sticky note somewhere, but make sure you have access to that code and don’t give it out to anyone. Whoever has that code can control the bot. This code will always be here if you need it.
Advertisement
Section 2 of 3:
Sending the Bot to Server/Channel
-
Click Bot in the left-hand menu. This is also the jigsaw puzzle piece icon.
-
Check the toggles under the "Authorization Flow" header. You want "Public Bot" on if you want people other than yourself to have the ability to add the bot to their server. The toggle next to "REQUIRES OAUTH2 CODE GRANT" should be off unless the service your bot is using requires the toggle to be on.
-
Click OAuth2 and URL Generator . This menu has a section called "Scopes" with a bunch of empty checkboxes.
-
Check the boxes for the permissions you want your bot to have. For example, if you're creating a music-playing bot, you'd check Speak under "Voice Permissions."
-
Copy the generated URL. Click Copy next to the URL at the bottom of the page.
-
Paste the URL in your browser. Click your address bar in your web browser and paste the generated URL. A pop-up will prompt you to select a server to add the bot to.
- Select a server you own or have admin permissions to, then confirm that you're human. Finally, click Authorize to finish adding the bot to your server. [1] X Research source
- So far, you've created and added a bot to your Discord server! However, it won't reply to any commands or prompts until you code it . If you're not a skilled programmer, you can look into pre-programmed bots that you can simply add to your server .
Advertisement
Community Q&A
Search
-
QuestionMy bot says it's offline what do I need to do?Josh I GuessCommunity AnswerHave you done the code correctly? Try redoing the code. Make sure you do "node bot.js" without the quotes when you finish the code.
-
QuestionWhat do I do if it says error when typing node bot.js into command prompt?Josh I GuessCommunity AnswerHave you done the code correctly? Try redoing the code. Make sure you're typing everything right.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
Tips
Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
References
About This Article
Thanks to all authors for creating a page that has been read 106,304 times.
Advertisement