Starter kit to build a Discord Server Bot
Build-a-Bot requires Node.js v10+ to run. Install the dependencies and devDependencies and start the server.
$ git clone https://github.com/bsovs/build-a-bot.git
$ cd build-a-bot
$ npm i
$ node server.js
$ node server
Run to create a new bot command (creates cmd, flag, and test files)
$ npm run new
Run mocha tests in intellij or by running the following test command
$ npm run test
Create a new application at:
https://discord.com/developers/applications
Copy your bot token (should be in the General tab) and head over to
https://discord.com/oauth2/authorize?scope=bot&client_id=YOUR_CLIENT_ID
Should look something like this
Add your bot to your server
Copy over your bot token to the config.json file
./config.json
Test it out!
Launch usingnode server
in command promt, then send!ping
in discord
*Note: if you have node yet installed depandancies do so now using the following commands,
$ npm i
$ node server.js
Customise a new command.
Usenpm run new
to create a new command.
Open up your new command (found in ./src/bot/commands/)
Once your command is registered you can refresh it by sending!refresh *your command*
to discord.
In order to keep your bot running all the time we suggest using Heroku hosting solutions.
Head over to https://devcenter.heroku.com/articles/git and learn about how to deploy nodejs apps to Heroku
Add your config variables fromconfig.json
to your apps environment variables.