- Member Since: January 18, 2022
- https://gogodev.info/features-of-discord-bot-chat/
Description
Create a Discord Bot with shrink instructions in 169 Seconds - Discord.js v13 Academic
I'm going to show you how to make a Discord bot with scale back commands utilizing the discord.js library. . Bots are perfect for when you don't have any associates to discuss with. . First visit the discord developer portal and click on new application. . name it, then go to the bot tab and click 'add bot'. Upload an icon then go to . the oauth2 tab. lower than scopes, select 'bot' and 'application.commands' and iif you want select . 'send hug bot discord '. copy the link after which go to the link to authorize the bot on your server.. Replit subsidized this path and that they make it speedy and straightforward to set up a Discord bot. Create . a new repl and choose 'Node.js'. we've to install Node version 16 so discord.js will paintings. . within the shell I will paste in a command that also is during this video's description. . Now i am going to create a file named '.replit' and add run npm start. in package.json,.
below 'scripts', i am going to upload start node interval . Node 16 will work now.. i am going to go over to the discord.js doctors and reproduction this code to sign in slash instructions. . i'll beyond it in. We will store our IDs and token as environment variables so i am going to click on this 'lock' . icon and that i can add keys and values. This first one is 'token'. again on the developer portal . i am going to replica the token and paste it within replit. Now I will make one referred to as 'guild_id'. A guild is . a similar component as a discord server. This identity is the first number in the URL bar on my Discord server.. i am going to paste this in and then make a 'client_id'. that is present in the . developer portal lower than fashionable information and is also called an 'application' identity. . i'll reproduction it and paste it in replit. I'll add the key then scroll down and click . the insert button to feature the code to access a mystery. i am going to change this call to token,.
Then replica this twice. I will get the client identification and guild id in a variable. Now i am going to update the instructions. Here we are only registering the instructions. In one other dossier we can specify what the commands correctly do. The command ziz will respond with 'yo'. The command 'video' will reply with a link to the latest video on my channel. Now i'll just update this token to be the variable name in preference to a string. And I'll run this system. Ok, achievement. This program to sign in the instructions simply ought to be run as soon as. Now we'll create the bot application that will run constantly. i'll go back to the medical doctors and copy the code for the subsequent file. i'll create a brand new file referred to as bot.js and paste in the code. Now I will get the token variable from index.js and placed it in bot.js. be sure this token is the variable.
Now time to specify the instructions. For ziz, the reply ought to be yo! i'll simply replica and paste and create the command 'video' which will respond with a link to the latest video. In kit.js i'll update leading so it will run bot.js as opposed to index.js. Now i am going to run the program. Time to test it on Discord. If I type minimize ziz, yo! If I type scale back video, there is the latest video! it really works. And iif you want to make the bot run continuously you can improve to the hacker plan and permit 'always on'. There is also discord girlfriend bot to do it utilizing uptime robotic yet I don't have time to explain that. thanks for watching. You can now positioned discord bot developer on your resume.