A Slack Bot called Dumbledore that lets your team join houses and award house points.
Clone or download
#211 Compare This branch is 359 commits ahead of BenC14:master.
ho1234c Merge pull request #210 from ho1234c/master
Fixed bug in app listen
Latest commit 35bff9e Nov 19, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Removed password field and Added token validation Nov 16, 2017
lib Merge remote-tracking branch 'upstream/master' Nov 19, 2017
page Fixed bug in app listen Nov 19, 2017
parse-server Developed show log in frontend Nov 19, 2017
public Removed favicon in html Nov 16, 2017
server Fixed bug in app listen Nov 19, 2017
spec add reaction cancel situation and update and delete other code Nov 17, 2017
.env_sample hi Nov 6, 2017
.eslintignore fix CI environment Nov 9, 2017
.eslintrc
.gitignore update readme Nov 12, 2017
.stickler.yml add stickerci ignore Nov 10, 2017
.travis.yml build after install for travis and heroku Nov 10, 2017
LICENSE.txt Create LICENSE.txt Jan 6, 2017
README.md
nodemon.json save botId / message archive Nov 11, 2017
package.json Developed show log in frontend Nov 19, 2017

README.md

Dumbledore

A Slack Bot called Dumbledore that lets your team join houses and award house points.

Installation

  • clone this reposity to the machine you want to run the server on.
  • If you do not have node >= 8.0.0 and npm installed on your machine install it
  • in the dumbledore directory run:
$ npm install

Running Dumbledore

To run the Dumbledore you must have an API token to authenticate the bot on your slack channel. Once you get it (instructions on the next paragraph) you just have to run:

$ BOT_API_KEY={key} BOT_NAME={name} node bin/bot.js

Getting the API token for your Slack channel

To allow the Dumbledore to connect your Slack channel you must provide him an API key. To retrieve it you need to add a new Bot in your Slack organization by visiting the following url: https://yourorganization.slack.com/services/new/bot, where yourorganization must be substituted with the name of your organization (e.g. https://dumbledoretest.slack.com/services/new/bot). Ensure you are logged to your Slack organization in your browser and you have the admin rights to add a new bot.

You will find your API key under the field API Token, copy it in a safe place and get ready to use it.

Configuration - for development

Dumbledore is configurable through environment variables. There are several variable available:

Environment variable Description
BOT_API_KEY this variable is mandatory and must be used to specify the API token needed by the bot to connect to your Slack organization
BOT_NAME the name of your bot, it’s optional and it will default to dumbledore
BOT_GITHUB_CHANNEL_ID the channel id for your teams github tracker(optional)

Development

  • We recommend the nodemon:
$ npm install -g nodemon
$ cp ./.env_sample ./.env
// You need to change `.env`
$ npm run dev

Test

$ cp ./.env_sample ./.env
// You need to change `.env`
$ npm test

Configuration - for Production

Dumbledore use parse-server for backend.

Environment variable Description
DATABASE_URI mongodb connection string
APP_ID the application id for backend parse-server
MASTER_KEY the masterkey for backend parse-server
PORT the external port for web-server
PARSE_EXTERNAL_URL the external parse-server url by web-server proxy. ex) https://yourdomain/api/parse
ADMIN_NAME the id for signin to dashboard
ADMIN_PASS the password for signin to dashboard

Production

  • Default is npm start, but you can also use the pm2:
  • Dumbledore needs a mongodb for production.
$ cp ./.env_sample ./.env
// You need to change `.env`
$ npm start

Making Dumbledore

This bot was based off the work of lmammino and the norrisbot project. I created most of the bot in a few days, but this is still an early version and I recognize the code could be much inproved.

How to Use Dumbledore

  • To professor
`professor` best student
`professor` worst student
`professor` tell me about @user
`professor` list student score
  • To user
'num' points to @user
  • Reaction
When user answer to you
Give point by doing reaction
'100' || '+1' || 'grinning' || 'heart'

License

Licensed under MIT License.