Source code for the PTG event scheduling bot
Go to file
Zuul b34f265f24 Merge "Change OpenStack to Open Infrastructure in README.rst title" 2019-04-27 21:11:29 +00:00
html Remove last GitHub links for help 2019-04-15 16:34:04 +02:00
ptgbot Order JSON config import 2019-04-17 13:45:37 +02:00
.gitignore ignore local config file 2017-08-31 09:29:37 -04:00
.gitreview OpenDev Migration Patch 2019-04-19 19:40:44 +00:00
LICENSE Initial commit 2017-04-18 14:21:26 +02:00
README.rst Merge "Change OpenStack to Open Infrastructure in README.rst title" 2019-04-27 21:11:29 +00:00
config.json.sample Switch example IRC port to 6697 2019-04-26 18:27:19 +01:00
requirements.txt Pin irc module to 15.1.1 to avoid import error 2018-12-21 15:35:09 +01:00
setup.cfg Initial commit 2017-04-18 14:21:26 +02:00 Initial commit 2017-04-18 14:21:26 +02:00
test-requirements.txt Initial commit 2017-04-18 14:21:26 +02:00
tox.ini Initial commit 2017-04-18 14:21:26 +02:00


Open Infrastructure PTG Bot

ptgbot is the bot that PTG track moderators use to surface what's currently happening at the event. Track moderators send messages to the bot, and from that information the bot builds a static webpage with several sections of information:

  • The discussion topics currently discussed ("now")
  • An indicative set of discussion topics coming up next ("next")
  • The tracks pre-scheduled for the day
  • The tracks which booked available slots in the additional rooms

Track moderators commands

By default the bot allows anyone in the channel to issue track moderation commands. However note that it is possible for admins to restrict access to people who have voice in the channel (+v).

Commands follow the following format:


Here is the list of available commands.


The now command indicates the current topic of discussion in a given track. Example usage:

#swift now discussing ring placement
  • Your track needs to exist in the system, and be scheduled in the day. Information about the room will be added automatically from the schedule.
  • You can mention other tracks by using the corresponding hashtags, like: #nova now discussing multi-attach with #cinder.
  • There can only be one now discussion topic at a time. If multiple topics are discussed at the same time in various corners of the room, they should all be specified in a single now command.
  • In order to ensure that information is current, entering a now command wipes out any next entry for the same track.


The next command lets you communicate the upcoming topics of discussion in your track. You can use it as a teaser for things to come. Example usage:

#swift next at 2pm we plan to discuss #glance support
#swift next around 3pm we plan to cover cold storage features
  • Your track needs to exist in the system, and be scheduled in the day.
  • You can specify multiple next discussion topics. To clear the list, you can enter a new now discussion topic, or use the clean command.
  • Since passing a new now command wipes out the next entries, you might want to refresh those after entering a now topic.


The book command is used to book available slots in the additional rooms. Available time slots (at the bottom of the PTGbot page) display a slot code you can use book the room. Example usage:

#vitrage book Missouri-MonAM
  • Your track needs to exist in the system.
  • Once you booked the slot, you are part of the schedule for the day, and you can use the now and next commands to communicate what topic is being discussed.


The unbook command is used to free up booked slots in the additional rooms. You should generally not unbook a track without the consent of its track lead. Example usage:

#vitrage unbook Missouri-MonAM


You can remove all now and next entries related to your track by issuing the clean command (with no argument). Example usage:

#ironic clean


By default all tracks appear as blue badges on the page. You can set your own color using the color command. Colors can be specified in any form supported by the CSS attribute background-color:

#infra color red
#oslo color #42f4c5
  • The color command only sets the background color for the track name. The foreground is always white.


The room your track discussions happen in should be filled automatically by the PTGbot by looking up the schedule information. In case it's not right, you can overwrite it using the location command. Example usage:

#oslo location Level B, Ballroom A

Admin commands

You have to be a channel operator (+o) to use admin commands.


List available track names

~add TRACK [TRACK..]

Add new track(s)

~del TRACK [TRACK..]

Deletes track(s)

~clean TRACK [TRACK..]

Removes active entries for specified track(s)


Removes now/next/location entries, to be run at the start of a new day


Adds a message of the day on top of the rendered page. Level must be one of info, success, warning or danger.


Removes message of the day on top of the rendered page.


Resets the database entirely to minimal contents

~fetchdb URL

Fetches JSON DB from specified URL. Any JSON key specified will replace existing data in database.


Requires that users are voiced (+v) to issue track moderation commands


Allows everyone in the channel to issue track moderation commands

Local testing

Copy config.json.sample to config.json:

cp config.json.sample config.json

Edit config.json contents, for example:

"irc_nick": "ptgbot",
"irc_server": "",
"irc_port": 6697,
"irc_channel": "#testptg",
"db_filename": "html/ptg.json",

In one terminal, run the bot:

tox -evenv -- ptgbot -d config.json

Join that channel and give commands to the bot:

#swift now discussing ring placement

(note, the bot currently only takes commands from Freenode identified users)

In another terminal, start the webserver:

cd html && python -m SimpleHTTPServer

Open the web page in a web browser: