Create a Discord Bot with scale back Commands in 169 Seconds - Discord.js v13 Academici'll enable you make a Discord bot with curb instructions utilizing the discord.js library. . Bots are ideal for when you haven't any friends to discuss with. . First go to the discord developer portal and click new application. . Call it, then go to the bot tab and click on 'add bot'. Upload an icon then go to . the oauth2 tab. lower than scopes, choose 'bot' and 'application.commands' and iif you want select . 'send messages'. Reproduction the link after which go to the link to authorize the bot in your server.. Replit backed this path and that they make it fast and easy to set up a Discord bot. Create . a new repl and choose 'Node.js'. We have to install Node version 16 so discord.js will paintings. . within the shell i am going to paste in a command that is also in this video's description. . Now i'll create a dossier named '.replit' and upload run npm begin. in package.json,.<iframe src="https://www.youtube.com/embed/eoYvh4q3WDw" width="560" height="315" frameborder="0" allowfullscreen></iframe>under 'scripts', i am going to add start node interval . Node sixteen will paintings now.. I will cross over to the discord.js docs and reproduction this code to register lower commands. . i am going to beyond it in. we are going to store our IDs and token as surroundings variables so i am going to click this 'lock' . icon and that i can upload keys and values. This first one is 'token'. lower back at the developer portal . i am going to replica the token and paste it within replit. Now i am going to make one called 'guild_id'. A guild is . an identical thing as a discord server. This id is the first quantity in the URL bar on my Discord server.. I will paste this in and then make a 'client_id'. it is found in the . developer portal less than preferred information and is also known as an 'application' identity. . i am going to copy it and paste it in replit. I'll upload the secret then scroll down and click . the insert button to feature the code to access a secret. i'll change this name to token,.Then replica this two times. https://mega-dance.info/welcomer-bot-discord/ will get the purchaser identity and guild identification in a variable. Now I will update the commands. Here we are only registering the instructions. In one more file we can specify what the commands actually do. The command ziz will reply with 'yo'. The command 'video' will reply with a hyperlink to the most recent video on my channel. Now i am going to simply replace this token to be the variable call instead of a string. And I'll run this system. okay, fulfillment. This program to sign in the commands simply ought to be run once. Now we are going to create the bot software that will run constantly. I will return to the docs and copy the code for the subsequent dossier. i am going to create a new file known as bot.js and paste in the code. Now i'll get the token variable from index.js and put it in bot.js. Ensure this token is the variable.Now time to specify the commands. For ziz, the reply should be yo! i'll just replica and paste and create the command 'video' which will reply with a hyperlink to the latest video. In package.js i'll replace main so it will run bot.js rather than index.js. Now i'll run this system. https://mega-dance.info/birthday-discord-bot/ to test it on Discord. If I sort minimize ziz, yo! If I type reduce video, there is the latest video! It works. And iif you want to make the bot run continuously you can improve to the hacker plan and allow 'always on'. There is also a unfastened way to do it using uptime robotic yet i haven't got time to explain that. Thank you for watching. You can now placed discord bot developer on your resume. |