I am learning how to code, and I am working on making a bot that actually works for my discord server. My code is apsolutely terrible, and I am brand new to Java.script I am working on this bot, as a project for the near future. I want people to learn how to code, so my intention is to make a website, and let them run their own discord bots. They can see the code that is being ran while their discord bot is running, and very informational of how this works. The only file on here is the index.js file. I will be adding more files later on in the near future. Enjoy the horribleness of the code. Enjoy! (Join the official bot discord server here: https://discord.gg/45Fkt7V)
There aren't really many features on the bot, but there are a few.
#1: Repeating messages. If you do b/say , the bot will repeat that message back to you. Just a fun way to keep the bot interactive.
#2: Reporting. Most bots don't have a feature like that. If you need to report someone, you can report it. Do b/report . Its a bit disorganized, I know, but it works alright. You do need a #reports channel or else, the bot cannot send the report in.
#3: Suggesting items. Some bots do have them. Some of them don't. People can suggest what they feel like, or what they want to add. People can react with a checkmark or an X mark. Check means yes, X means no. Its their opinion. You do need a #suggestions channel, or else, the bot cannot send the suggestions. Its a fun way to keep the bot a bit more entertaining. -__-
#4: Moderation commands and permission checking. If you want to check what permissions you have on the bot, do b/permissions. The moderation commands are b/clear, b/kick and b/ban. You will need these permissions to use these commands, if you do not have them. For b/clear, you need to have MANAGE_MESSAGES enabled in your role. For b/kick, you need to have KICK_MEMBERS on in order to kick members. For b/ban, you need to have permissions BAN_MEMBERS in order to ban members. There is no checking yet on the bot when kicking/banning players. Sorry. That will be added soon. I promise...
#5: Checking minecraft server status. If your favorite server is online, you can check your favorite minecraft server in discord before joining, without having to log into minecraft. (NOTE: This only works for Minecraft Java Edition)
I can add more features. Idk yet since I suck at coding...
Step 1: you are going to go to https://nodejs.org/en/ and download the reccomended version. Then, you are going to download Visual Studio Code. Download here >>>> https://code.visualstudio.com/. Set up node on your desktop, and follow intructions on how to set it up. It will create a file for you for node. We would highly reccomend for you to name your file "Discord Bot" or any file you want. This is super imporant, because when you go to command promt (cmd), you will have to type in this file name the node.js is in. Place your node.js file, in the computer screen where your other apps are.
Step 2: Go to command promt, and type in "cd desktop", then you are going to type in "cd file name where your node is located", and then type in "npm init". This will create a .json file.
Step 3: READ HERE SUPER CAREFULLY, BECAUSE THIS MAY MESS UP YOUR JSON FILE!!! After you do create your json file, the first thing will show up is Package Name. Place a name for that file there, or else, you cannot move ahead. You will get Version next. Do not edit that. Then click enter. This, you can edit if you want too, and add something neat. You do not have to do this if you want too. This will not change the bot in any way or function at all. Then click enter. You will get an entry point called index.js where your code will go. DO NOT EDIT THIS AT ALL!!!! Then click enter. Then you will get test command. I would not reccomend to edit. Then click enter. You will get git repository. Do not edit this at all. Then click enter. Then, you will get Keywords. We do not reccomend to edit this at all. Then click enter. Then you will get Author. You can add your name on it if you want too. Then click enter. Then you will get your lisence. DO NOT EDIT THAT IN ANY WAY!!! Then, click enter twice. A file was now officially created for your discord bot
Step 4: Open up Visual Studio Code.
Step 5: Click open file, and add the file where your node.js is. Then you have officially opened up a new code project!
Step 6: Then, your going to make an index.js file, where all of your really important code will go. On the top of the screen, where your file name is (Like Discord Bot), click add file, and call it index.js. This is where you will be running your code for the discord bot.
Step 7: On Line 15, where it says "Place Bot Token Here," place your bot token there. You can find your bot token in your "Discord Applications"
Step 8: On Windows, hold down these 2 keys for about 0.4 seconds, crtl + tidle key (The Tidle Key looks like this.
. You can find this at the top left hand cornder, right below the esc key.
Step 9: Type into your terminal section "node index.js" then you will recieve a message below saying the bot is online! If the token isnt there, the bot cannot run at all.
If you had any trouble with this, I would so reccomend watching this video, because my intructions may not fully work properly. Watch here: https://www.youtube.com/watch?v=X_qg0Ut9nU8&t=2s