Today’s article will be an exhaustive and in-depth one because today we will learn how to make discord bot. There will be various stages in this, and all of them need proper execution for the bot to work.
Different Stages About How to Make Discord Bot
Stage 1: Download Node.js and Set Up a Discord Account
You’ll likewise require a Discord account, and your server to use to test your bot. On the off chance that you haven’t made one yet, go to Discord.com and make one. If you do have one, sign in to your account and open up the server where you need your bot to reside.
You’ll likewise require a content management program, as Notepad++ on Windows, to code with.
Stage 2: Create Your Bot
What you must do currently is create an application on discord that will make the bot operate or work. This takes a little doing, yet all at once, it’s not very perplexing. The objective here is to get an “approval token” for the bot so that Discord perceives your code and includes it in the bot its servers.
To start with, head to discordapp.com/developers/applications/me. Your account ought to be signed in, so you’ll go directly to your account’s rundown of applications. Hit New Application to get everything rolling. Give the bot a name, then, at that point, hit the button checked Save Changes.
Presently, on the right-hand menu, click Bot. Once in the new menu, click Add Bot under the Build-a-Bot choice. Assuming that you just have one application — the one we recently made — it ought to appear consequently. In any case, select it.
Stage 3: Get Your Bot’s Approval Token
In the crate checked App Bot User, search for the words Token: Click to Reveal. Snap that connection and you’ll uncover a line of the message. That is your bot’s approval token, which permits you to send it code. If you think the token has been compromised, fortunately, you can undoubtedly create another one with the Generate a New Token button. Discount your token. You’ll require it in a second.
Stage 4: Send Your Bot to Your Server
Presently look up to the case-checked App Details and track down your Client ID, a long number. Duplicate the number and add it to this URL, in the spot of the word CLIENTID.
The last URL should resemble this, yet with your customer ID number in it rather than this phony one:
Duplicate the URL with your customer ID number into your program. That will take you to a site where you can let Discord know where to send your bot. You’ll realize it worked on the off chance that you open Discord in an app or your program and explore to your server. The channel will say a bot has joined the room, and you’ll see it on the right side menu under the rundown of online members.
Stage 5: Create a ‘bot’ Organizer on Your Pc
While you’re doing that, you can likewise pause for a minute to make an organizer in a simple to-arrive at a place on your PC where you can store all your bot’s records. Call it something basic, as “DiscordBot” or “MyBot,” so you know precisely what it is.
Stage 6: Open Your Content Manager and Make Your Bot’s Records
You will make three records for your bot from your word processor. In the primary, glue this code:
“token”: “Your Bot Token”
Supplant “Your Bot Token” with the symbolic you produced before on your bot’s application page. Ensure the token is inside the quotes. Now, you must save the record inside the Discord bot folder that you created on your desktop, with the file name “auth.json”. Be doubly sure that you do not save it as .txt or else it won’t work. It only works for.json file type.
Make another document, and put in this code:
“portrayal”: “My First Discord Bot”,
“creator”: “Your Name”,
Supplant the creator name with your name assuming you need it; you can likewise change the portrayal to something else assuming you need something more by what you’re making, which will help remember what your bot should do.
Save this record as “package.json” in your Discord bot folder.
Stage 7: Define Your Bot’s Code
Stage 8: Open Your Pc’s “Order Prompt” and Explore Your Discord Bot Organizer
On a Windows PC, you can without much of a stretch get to the Command Prompt by tapping the Windows symbol and composing Command Prompt in the field. When it’s open, type “disc” trailed by the record way to your folder. The order resembles this: “c: UsersPhil’sDesktopDesktopDiscordBot” (The order is arbitrary, and will appear to be unique as indicated by your way or area). That should change the order brief line to incorporate the record way to your folder.
On the other hand, you can explore your organizer in Windows and hold Shift while right-tapping on a clear space of the folder and picking Open Command Prompt.
Stage 9: Use the Command Prompt to Introduce Your Bot’s Conditions
Presently it’s time to utilize Node.js. In the Command Prompt, with your Discord bot organizer in the document way line, type “npm introduce discord.io winston – save.” This will consequently introduce records you want to for your Discord bot into the folder straightforwardly.
That ought to furnish you with every one of the documents you want.
Stage 10: Run the Bot
Presently you’re all set. To take a stab at running your bot, type “hub bot.js” in the Command Prompt (ensure you’re explored to your Discord bot folder).
To test your bot’s usefulness, get back on your Discord server and take a stab at composing in “!introduction,” or “!” followed by the brief message you made in your “bot.js” record. On the off chance that you coded your bot accurately, sending this order will make your bot answer to you with your set message.
Congrats, you are the pleased maker of a Discord bot.
Stage 11: Figure Out if Your Bot Has Been Made by Someone Else
The incredible thing about Discord is the local area of shared interests and abilities. Clients on Discord are continually making new instruments to work on the assistance, including bots. Some makers will transfer their bots to public information bases and permit others to download the bots and use them for their servers. The bots recorded in data sets can have an assortment of capacities coded into them, so you’ll probably have the option to observe what you want. Before making your bot, do a little investigating on Discord to check whether someone else has effectively made only the bot you want.
This was all about how to make discord bot. Apart from how to make discord bot, there have been additional queries about discord, and I will cover all of them in the subsequent articles. Till then, peace out!