How To Make A Discord Bot | Basics (2021)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
In this simple tutorial, I will show you how to make the basics of a Discord bot at the cost of $0. What you will need is node.js, and a coding software such as Visual Studio Code or Atom. When it comes to downloading node.js, download the latest version, not the recommended one because it will not work. I already have Visual Studio Code installed, but just for the sake of it, I will reinstall it for the video. Now that they are both done downloading, you can install both applications. If you get this page, just hit yes. Now that you have installed both applications, what we will do is now make a folder. Name it whatever you want, I will call it Stacker, and what we're going to do here is we're going to go to your command prompt. We're going to "cd Desktop", "cd" into that folder, and then we're going to do "npm init". Oops. So, this will run you through the npm installation, so package name, Stacker, version, we'll just leave it as that, description, you can do that if you want, I'm not going to. Entry point: Leave that as that. Test command: don't need that. Git repository: don't need that. Keywords: don't need that. Author: I'll just call it Stacks. License: that's it. Just hit yes, and then there you go. What you should see now is that a package.json file has been created in the folder you just created. What we're going to do now is "npm install discord.js" (or "npm i discord.js"), which is kind of the programming language to build our bot basically. So we're just going to wait for that to install. If it says "WARN", just ignore it. We can now close this, and let's open up Visual Studio Code. Go to File, Open New Folder, locate the folder you just created. Yes, I trust the authors. Make a brand new file called "index.js", and, here we're going to make a "const". We're going to call it "Discord", and we're going to make it require the discord.js package. What we're going to do next is make another "const". Call it "client" (or it can be "bot") and that will equal to a "new Discord.Client()". So this right here is basically our bot. So, if the client is on and ready, we are going to log it saying that it's ready. client.on("ready"), pass an arrow function (=>), console. Whoops! That was completely off. console dot, console.log("I am ready to go!); And just before we do any more coding, let's actually create the Discord bot, so discord.com/developers, Go to New Application, call your bo- name your bot. I'll just call it Stacker. That's all I can think of. Then go to Bot, Add Bot, Yes do it, and right here is the token. Do not reveal this to anybody. I will be regenerating it after I finish recording this video. So copy your token, and then do "client.login("<your token")". I'm going to save that, and just before I do that, let's add it to a server, so I am going to copy its ID, and go to what I call the Discord Permissions Calculator, which I will just give it admin for now. You can do whichever ones you want. There's the link. I'm going to connect that one to Stacks's Second Server. Authorize I am human. and right there is the bot. It is not online just yet. Just before we run the bot, let's make a few commands, or just a simple command. So "client.on()", uhh, the message event. Pass in "message", arrow function (=>). Whoops. Pass in an async function with the word "message", arrow function, so "if(message.content === "!ping")", "message.channel.send("Hello");" And I will do a, uh, just one more. Ok, now that I have created two commands, we will save with CTRL + S or CMD + S if you're on a Mac. Open up your terminal using CTRL ~ or CMD ~ if you're on a Mac. I am not sure what the commands are on a Linux. But to run your bot, "node ." Just like that. Throw new type error Why am I getting? You know what? Ok, so I apparently missed a few things. We need to add some more in the "Discord.Client()", so we got to open it up and uh, "allowedMentions:" "parse: ['users', 'roles'];" There's a lot that I- I am not used to Discord.JS V13 "repliedUser: true" One more. "intents:" and there's a lot, so bare with me. GUILDS, GUILD- whoops. These have to be capitalized. GUILD_MESSAGES, GUILD_PRESENCES, GUILD_MEMBERS, and finally, GUILD_MESSAGE_REACTIONS. Go back to the bot portal and enable these two. Go back to your terminal, and run "node ." and there we are. The bot is ready. Now if I were to go back onto Discord, let's run the ping command, which I don't think it'll run anything, oh, yes it does! And, finally let's run our command I made called "salad". I'll let you have some time to read that. But yeah, if I do make another video on this, I will show you how to make commands, and that's it. No more. I am not making this into a full series like I did back in like, April of last year. If you didn't know, I actually used to be a coding channel. And then my other videos got popular, and I stopped uploading them. So a few of my subscribers are still subscribed for my coding videos, so here's the coding video guys! But anyways, that's going to wrap up today's video. If you enjoyed it or found it helpful, be sure to hit the subscribe button, follow my Twitter, and join my Discord server. Don't know why I asked to follow my Twitter first, but anyways, I will see you all in the next video.
Info
Channel: Stacks
Views: 35,192
Rating: undefined out of 5
Keywords: discord, discord bot, how to make a discord bot, discord.js v13, discord bot tutorial, discord.js, make a discord bot, discord bot tutorial 2021, discord bot 2021, discord.js 2021, how to make a discord bot in 2021, discord bot commands tutorial, discord.js tutorial, discord bot tutorial basics, discord bot maker, how to make a discord bot for free, how to make a discord bot for free 2021, free discord bot maker 2021, how to get a discord bot to come online, discord bot v13
Id: E6Dg1miuW_k
Channel Id: undefined
Length: 7min 27sec (447 seconds)
Published: Mon Oct 11 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.