Skip to content

A simple bot to notify a Slack channel when it's time to pick up your child at school!

License

Notifications You must be signed in to change notification settings

ArnaudLigny/leo-bot

Repository files navigation

leo-bot is a very simple bot based on Botkit to notice you when it's time to pick up your child at school!

Screen capture of the Slack bot

Installation

npm install

Deploy to Heroku

Node.js and Redis are required.

Configuration

You need to set environment variables (See .env.dist):

  • CHILD: Child firstname (ie: Léo)
  • CHANNEL: Slack channel (ie: #leo)
  • SCHEDULE: Cron schedule (ie: 0 45 17 * * 1-5)
  • SLACK_BOT_TOKEN: Slack token (create one at my.slack.com/apps/A0F7YS25R-bots)
  • REDIS_URL: URL to the Redis server (ie: redis:https://:[email protected]:1234)
  • TZ: Time Zone (ie: Europe/Paris)

The cron-style scheduling format consists of:

*    *    *    *    *    *
┬    ┬    ┬    ┬    ┬    ┬
│    │    │    │    │    |
│    │    │    │    │    └ day of week (0 - 7) (0 or 7 is Sun)
│    │    │    │    └───── month (1 - 12)
│    │    │    └────────── day of month (1 - 31)
│    │    └─────────────── hour (0 - 23)
│    └──────────────────── minute (0 - 59)
└───────────────────────── second (0 - 59, OPTIONAL)

Usage

# Served with hot reload (+ ESLint verification).
npm run dev

# Start server in production environment.
npm run start

Supported Slack commands

Just ask help to @leo-bot.

Deploy

Heroku (CLI)

heroku create --buildpack https://github.com/heroku/heroku-buildpack-nodejs.git
heroku addons:create heroku-redis:hobby-dev
heroku config:set CHILD='Léo'
heroku config:set CHANNEL='#leo'
heroku config:set SCHEDULE='0 45 17 * * 1-5'
heroku config:set SLACK_BOT_TOKEN=xoxb-XXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXX
heroku config:set TZ=Europe/Paris
heroku ps:scale web=0 worker=1

Development

This project uses ESLint for its syntax. You should read some documentation before.

# Run ESLint to check if code respects it's syntax.
npm run lint

Source

https://github.com/ArnaudLigny/leo-bot

License

leo-bot is a free software distributed under the terms of the MIT license.

© Arnaud Ligny

About

A simple bot to notify a Slack channel when it's time to pick up your child at school!

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project