Source code for the PTG event scheduling bot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

  1. ===========================
  2. Open Infrastructure PTG Bot
  3. ===========================
  4. ptgbot is the bot that PTG track moderators use to surface what's
  5. currently happening at the event. Track moderators send messages to
  6. the bot, and from that information the bot builds a static webpage
  7. with several sections of information:
  8. * The discussion topics currently discussed ("now")
  9. * An indicative set of discussion topics coming up next ("next")
  10. * The tracks pre-scheduled for the day
  11. * The tracks which booked available slots in the additional rooms
  12. The bot also allows people to voluntarily check into (and out of)
  13. tracks or other arbitrary locations, if they want to be found more
  14. easily by other people.
  15. User commands
  16. =============
  17. Anyone can privately message the bot with the following commands:
  18. * ``in #TRACKNAME`` - tells the bot you are currently in the track
  19. named ``TRACKNAME``. This must be one of the tracks it knows about,
  20. for example: ``in #nova``
  21. * ``in LOCATION`` - tells the bot you are currently in a location
  22. which doesn't correspond to any track. This can be any freeform
  23. text, for example: ``in the pub``
  24. * ``out`` - tells the bot you've checked out of your current location.
  25. However others will still be able to see when and where you checked
  26. out.
  27. * ``seen NICK`` - asks the bot where the user with the given IRC nick
  28. was last seen (if anywhere). The nick is case-insensitive.
  29. * ``subscribe REGEXP`` - subscribes for a direct message notification
  30. from the bot whenever a topic with a substring matching ``REGEXP``
  31. is set via the ``now`` or ``next`` commands (see below). The exact
  32. string the (case-insensitive) regular expression will be matched
  33. against is of the form ``#track now topic`` (i.e. the same as the
  34. full commands issued by track moderators). So for example
  35. ``subscribe #nova.*test|python *3`` would match any testing topics
  36. in the nova track, and any Python 3 topics in any track.
  37. * ``subscribe`` - shows your current subscription regular expression
  38. (if any)
  39. * ``unsubscribe`` - cancels your current subscription (if any)
  40. The above commands also work in the channel when prefixed with ``#``,
  41. for example ``#in the pub``. You can use the ``#`` prefix with
  42. private messages to the bot too, in case you don't want to memorise
  43. different syntax for these commands depending on whether you are
  44. messaging the bot privately or in a channel.
  45. Track moderators commands
  46. =========================
  47. By default the bot allows anyone in the channel to issue track moderation
  48. commands. However note that it is possible for admins to restrict access
  49. to people who have voice in the channel (+v).
  50. Commands follow the following format::
  52. Here is the list of available commands.
  53. now
  54. ---
  55. The ``now`` command indicates the current topic of discussion in a given
  56. track. Example usage::
  57. #swift now discussing ring placement
  58. * Your track needs to exist in the system, and be scheduled in the day.
  59. Information about the room will be added automatically from the schedule.
  60. * You can mention other tracks by using the corresponding hashtags, like:
  61. ``#nova now discussing multi-attach with #cinder``.
  62. * There can only be one ``now`` discussion topic at a time. If multiple
  63. topics are discussed at the same time in various corners of the room,
  64. they should all be specified in a single ``now`` command.
  65. * In order to ensure that information is current, entering a ``now`` command
  66. wipes out any ``next`` entry for the same track.
  67. next
  68. ----
  69. The ``next`` command lets you communicate the upcoming topics of discussion in
  70. your track. You can use it as a teaser for things to come. Example usage::
  71. #swift next at 2pm we plan to discuss #glance support
  72. #swift next around 3pm we plan to cover cold storage features
  73. * Your track needs to exist in the system, and be scheduled in the day.
  74. * You can specify multiple ``next`` discussion topics. To clear the list, you
  75. can enter a new ``now`` discussion topic, or use the ``clean`` command.
  76. * Since passing a new ``now`` command wipes out the ``next`` entries, you
  77. might want to refresh those after entering a ``now`` topic.
  78. book
  79. ----
  80. The ``book`` command is used to book available slots in the additional rooms.
  81. Available time slots (at the bottom of the PTGbot page) display a slot code
  82. you can use book the room. Example usage::
  83. #vitrage book Missouri-MonAM
  84. * Your track needs to exist in the system.
  85. * Once you booked the slot, you are part of the schedule for the day, and
  86. you can use the ``now`` and ``next`` commands to communicate what topic
  87. is being discussed.
  88. unbook
  89. ------
  90. The ``unbook`` command is used to free up booked slots in the additional rooms.
  91. You should generally not unbook a track without the consent of its track lead.
  92. Example usage::
  93. #vitrage unbook Missouri-MonAM
  94. clean
  95. -----
  96. You can remove all ``now`` and ``next`` entries related to your track by
  97. issuing the ``clean`` command (with no argument). Example usage::
  98. #ironic clean
  99. etherpad
  100. --------
  101. By default the bot generates etherpad links for all tracks. If you already
  102. have an etherpad, you can set its URL using the ``etherpad`` command::
  103. #keystone etherpad
  104. If you set a URL and would like to revert to the autogenerated name, you can
  105. pass ``auto`` as the etherpad URL::
  106. #keystone etherpad auto
  107. url
  108. ---
  109. A URL can be associated to a track, for example pointing to where the video
  110. meeting happens. By default the bot points to the URL associated to the room,
  111. if any. You can override it using the ``url`` command::
  112. #keystone url
  113. If you set a track-specific URL and would like to remove it, you can pass
  114. ``none`` as the URL::
  115. #keystone url none
  116. color
  117. -----
  118. By default all tracks appear as blue badges on the page. You can set your
  119. own color using the ``color`` command. Colors can be specified in any
  120. form supported by the CSS attribute background-color::
  121. #infra color red
  122. #oslo color #42f4c5
  123. * The color command only sets the background color for the track
  124. name. The foreground is always white.
  125. location
  126. --------
  127. The room your track discussions happen in should be filled automatically
  128. by the PTGbot by looking up the schedule information. In case it's not right,
  129. you can overwrite it using the ``location`` command. Example usage::
  130. #oslo location Level B, Ballroom A
  131. Admin commands
  132. ==============
  133. You have to be a channel operator (+o) to use admin commands.
  134. ~list
  135. List available track names
  136. ~add TRACK [TRACK..]
  137. Add new track(s)
  138. ~del TRACK [TRACK..]
  139. Deletes track(s)
  140. ~clean TRACK [TRACK..]
  141. Removes active entries for specified track(s)
  142. ~newday
  143. Removes existing now/next/location/presence entries. This command is
  144. meant to be run at the start of a new day
  145. ~motd LEVEL MESSAGE
  146. Adds a message of the day on top of the rendered page. Level must be one of
  147. info, success, warning or danger.
  148. ~cleanmotd
  149. Removes message of the day on top of the rendered page.
  150. ~emptydb
  151. Resets the database entirely to minimal contents
  152. ~fetchdb URL
  153. Fetches JSON DB from specified URL. Any JSON key specified will replace
  154. existing data in database.
  155. ~requirevoice
  156. Requires that users are voiced (+v) to issue track moderation commands
  157. ~alloweveryone
  158. Allows everyone in the channel to issue track moderation commands
  159. Local testing
  160. =============
  161. Copy config.json.sample to config.json::
  162. cp config.json.sample config.json
  163. Edit config.json contents, for example::
  164. {
  165. "irc_nick": "ptgbot",
  166. "irc_server": "",
  167. "irc_port": 6697,
  168. "irc_channel": "#testptg",
  169. "db_filename": "html/ptg.json",
  170. }
  171. In one terminal, run the bot::
  172. tox -evenv -- ptgbot -d config.json
  173. Join that channel and load base JSON data from a public URL (see base.json
  174. for an example). You can use the pastebin service as a quick way to publish
  175. that data::
  176. ~fetchdb
  177. Then you can give other commands to the bot, like::
  178. #swift now discussing ring placement
  179. (note, the bot currently only takes commands from Freenode identified users)
  180. In another terminal, start the webserver::
  181. cd html && python -m SimpleHTTPServer
  182. Open the web page in a web browser: