Skip to content

A simple node / Discord.js bot template for beginners with eval command

License

Notifications You must be signed in to change notification settings

CodingAgent1337/Discord-Bot-Template

 
 

Repository files navigation

Simple Discord Bot Template

This project is being archived and replaced with this Discord Bot Template 2 for better stability, performance and wider feature set.

About

This is a rather simple Discord bot built on node.js using the Discord.js api.

Installation

For starters you need Node.js and you'll want the current version. 8.0.0 or newer is required.

Once you're sure you have node.js open the folder all the files are located and shift + right click > Open command window here. You'll then want to run the following command

npm install

Ignore any warnings about unmet peer dependencies, as they're all optional from Discord.js.

Setup Bot

Rename config.example.json to config.json and inside it you'll want to replace the token in there with your bot token that you get from Discordapp Dev. If you don't already have an app in there, create one. then press the button to turn the app into a bot user. click to reveal your Token and paste that into the config.json Do NOT share this with anyone While you're in there copy down your "Client ID", you'll need it later.

Next you'll want to put your owner ID in the config.json. to get that, enable Developer Mode in discord under Settings > Appearance > Advanced > Developer Mode. After that you can just right click your username and Copy ID.

Set whatever Prefix you'd like in there while you're at it. The prefix is the character you'll type before a command.

If all went well you should be able to run Normal Start.bat and see "Bot is online!" in the console window.

Invite Bot

Remember that "Client ID" I asked you to write down for later, above? Well we're gonna use that now to generate an invite link for your bot.

You can use a Discord Permissions Calculator or just do what I do and give your bot all permissions by default using

https://discordapp.com/oauth2/authorize?client_id=############&scope=bot&permissions=2146958591

Replace the ############ with your Client ID

Then going to the link will ask you what server you want the bot on. I think you can manage that part.

Optional Part [Always Online Bot]

You might notice there's some files called PM2 Start.bat, PM2 Stop.bat and PM2 Console Log.bat. These are for using PM2 which is a package that keeps node programs running after they've crashed or something. If you don't care about this, delete those 3 files. However if you do want to use this, open a command window again like before shift + right click > Open command window here. then type

npm install -g PM2

then instead of using Normal Start.bat you'll have to click PM2 Start.bat and to see the log click PM2 Console Log.bat. you can have all these windows closed and your bot will still be running in the background as long as it's powered. To stop you click PM2 Stop

Enjoy

Hopefully by now you have a working discord bot. Change up the code in index.js to add more functionality!

Important Links

Help

I don't exactly intend on helping everyone with any problems they have with this. if there's a bug i'll fix it but support is only available to the friends that I actually gave a link to this project to, Sorry. Check the Discord.js server above for discord.js related help and Google for all the JavaScript related help needs.

About

A simple node / Discord.js bot template for beginners with eval command

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.5%
  • Batchfile 2.5%