CSBot
(Proper name TBD)
This project is undergoing rapid development and should be considered experimental. Use it at your own risk.
🤙
Authors & Contributors
This list is updated as contributors contribute.
Table of contents
Usage or Development
Prerequisites
This project requires NodeJS (version 16.10 or later), NPM. To make sure you have them available on your machine, try running the following command:
$ npm -v && node -v
7.20.3
v16.15.1
Clone the Repo
$ cd path/to/parent
$ git clone https://github.com/BYU-CS-Discord/CSBot.git
$ cd CSBot
Get your own bot token
Note that, by running this bot, you agree to be bound by the Discord's Developer Terms of Service and Developer Policy, as well as this project's own license. With that in mind, you'll need a token for a Discord bot account. See this awesome tutorial on how to get one.
Configure the bot
Create a file called .env
in the root of this project folder. Paste your token into that file, and fill in other config items as desired:
# .env
DISCORD_TOKEN=YOUR_TOKEN_GOES_HERE
# required, token for your Discord bot
Do not commit this file to git or your bot will get "hacked".
Invite your bot to your server
Go to https://discordapi.com/permissions.html#378091424832 and paste in your bot's client ID to get an invite link.
Important Note for Windows Users
If you're on Windows, npm
scripts will not work unless you tell npm
to use Git Bash as its default shell when running commands.
Before continuing, run this command:
$ npm config set script-shell "C:\\Program Files\\Git\\bin\\bash.exe"
You must have Git for Windows installed. See this StackOverflow answer for more details.
Build the bot server
Be sure to install dependencies, and run a quick lint to generate needed files:
$ npm ci
$ npm run lint
The first time you download the source, and each time the source code changes, you'll need to run this command before you run the bot:
$ npm run build
Register Slash Commands
If you want support for Discord Slash Commands, you'll need to deploy the commands directly. To avoid rate limits, use a command-line tool, rather than deploying on startup.
Once you have your bot's account token in the .env file, run the following command to tell Discord about our commands:
$ npm run commands:deploy
Run the bot
Since this bot is just a Node script, any Node process manager will do.
$ node .
# or
$ npm start
# or
$ pm2 start .
Commands
/help
Prints the list of commands.
Contributing
This project is entirely open-source. Do with it what you will. If you're willing to help me improve this project, consider filing an issue.
See CONTRIBUTING.md for ways to contribute.
License
This project's source is licensed under the Unlicense license. All contributions thereto are given to the public domain.