Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Python script that powers the Dealabs office Slack bot who talks about TCL disruptions.


  • The bot automatically advise about current disruptions:
    • Which lines started or stopped to be disrupted
    • When disruption started and stopped
    • Can post on multiple Slack channels
    • Filter on specific lines
  • Ask the bot to check the current status of a specific line using commands (see below for more information) with the same information as above


  • Python 3. May eventually works with Python 2 (not tested)
  • A Slack team with an already-existing bot
  • A Data Grand Lyon (fr) account


  1. Clone this repo somewhere
  2. pip install -r requirements.txt
  3. python create_database


Copy the .env.example file to .env and fill in the configuration parameters.

Available configuration parameters are:

  • SLACK_BOT_TOKEN The bot API token (you can find it when editing the bot settings)
  • SLACK_BOT_ID You cannot find it now. Fill the other SLACK_* configuration paremeters, then run the python id command (see below for more information)
  • SLACK_BOT_NAME The bot username (not his name or last name!)
  • SEND_DISRUPTION_MESSAGES_TO A comma-separated list of Slack channel IDs in where to post automatic disruption messages. Empty to disable
  • DISRUPTIONS_LINES A comma-separated list of allowed TCL line names when sending automatic updates about disruptions. Empty to not filter
  • BOT_ADMINS A comma-separated list of Slack user IDs who can send admin commands to the bot. Empty to none
  • GRANDLYON_LOGIN Username used to login to your account
  • GRANDLYON_PASSWORD Password used to login to your account


Bot commands

Our bot is called pointtcl, but you'll obviously have to replace this name with your own bot name.

Get help

@pointtcl [aide|help|comment|dafuq|wut|hein]

Get a subway line status

@pointtcl [métro|metro] {{line name}}

Get a tram line status

@pointtcl tram {{line name}}

Get a bus line status

@pointtcl bus {{line name}}

Get a funicular line status

@pointtcl [funiculaire|funi] {{line name}}

Check current disruptions now (admin)

@pointtcl [verif|vérif]

Reset the internal database (admin)

@pointtcl resetbdd

CLI commands

Get the bot ID

After defining the SLACK_* configuration parameters in your .env file, you can run this command to get your bot ID:

python id

Fill the SLACK_BOT_ID configuration parameter with the output.

(Re)Create and seed the database with every available lines

This command will wipe out the database then re-create it from scratch.

python create_database

Connect the bot to the Slack RTM API and make him available to talk with

python run

You'll probably need Supervisor or similar to make him always-running.

Check for disruption on all lines and send message when there's one

This command also update the internal database of current disruptions.

python check_lines

Best usage is to create a Cron job that run it every, say, 5 minutes:

*/5 * * * * cd /path/to/pointtcl && python check_lines 2>&1

How it works

The Slack RTM API is used by the bot to check for incoming message from users. He also uses the Slack Web API to send messages in the appropriate channels. A small SQLite database is used to persist data.

The Data Grand Lyon API (fr) is used to check for disruptions, which is simple JSON data served through HTTP.


Python script that powers the Dealabs office Slack bot who talks about TCL disruptions