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

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS