What | Badge |
---|---|
Master Build | |
Staging Build | |
Maintainability | |
Test Coverage | |
Snyk |
A Discord bot for the Cascades Tech Club Discord server. To add a command, see the Commands section below.
To work on hackbot, you should:
git clone https://github.com/osu-cascades/hackbot.git
cd hackbot && npm install
npm start
[1] The !search command requires a Google API key from the Google API Console and the !weather command requires an API key from OpenWeather.org
In a nutshell, work in the dev branch and don't merge to master unless:
In all cases, be sure to run the test suite to make sure all tests pass. All tests should be passing before you merge dev to master.
You should embrace testing. hackbot uses the Jest test framework. Have two console panes open: one for running and watching the test suite, and the other for everything else you need to do. You can run the test suite once with npm test
. Once you get tired of running npm test
manually, use the watcher by running npm run test:watch
. It is sweet and people will think you are a super hacker. Look at __tests__/commands/add.test.ts
for an example of how to test commands and their channel messages. If you use VSCode for your IDE there's a Jest extension that will run a watcher and give you inline updates on your tests, as well as a few other awesome features!
Please refer to airbnb's style guide while coding.
For now try to keep the linter happy. You can see any lint issues by running npm run lint
. Some issues can be auto-fixed with npm run lint:fix
To enable hackbot to respond to a new command, all you need to do is:
cp src/commands/_template.ts src/commands/foo.ts
.CommandName
with your actual command name. Ensure that this js file contains a class definition that extends Command
and implements the static description
and execute
methods. See add.js or say.js for some simple examples.Hackbot is hosted on Heroku as two worker-based applications:
Once you're happy with your new hackbot feature running on your development environment, deploy it to staging so that the bot stays running and other people can try it out. This bot is always named hackbot-staging. Once you're happy, you can deploy it to production; this bot is always named hackbot.
heroku git:remote -a osu-hackbot -r production && heroku git:remote -a osu-hackbot-staging -r staging
git push staging
or git push staging dev:master
or git push staging feature-branch-name:master
.git push production
.©2018 All rights reserved.
Thanks to our contributors!