Browse Source

Generate etherpad links automatically

With this change, the ptgbot will generate links for each track
etherpad, display them on a specific page (etherpads.html) and
allow track moderators to override the autogenerated link using
the #track etherpad command.

It requires the database to contain an 'eventid' key which serves
as a unique etherpads prefix.

Change-Id: Iaa524530e9f2506369f180588a2b6f98f4cad3d1
Thierry Carrez 2 years ago
5 changed files with 73 additions and 1 deletions
  1. +14
  2. +47
  3. +1
  4. +2
  5. +9

+ 14
- 1
README.rst View File

@ -141,6 +141,19 @@ issuing the ``clean`` command (with no argument). Example usage::
#ironic clean
By default the bot generates etherpad links for all tracks. If you already
have an etherpad, you can set its URL using the ``etherpad`` command::
#keystone etherpad
If you set a URL and would like to revert to the autogenerated name, you can
pass ``auto`` as the etherpad URL::
#keystone etherpad auto
@ -229,7 +242,7 @@ In one terminal, run the bot::
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)

+ 47
- 0
html/etherpads.html View File

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta http-equiv="refresh" content="180">
<title>List of PTG Etherpads</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="bootstrap-3.3.7.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="container">
<h2>List of PTG Etherpads</h2>
<p>We use etherpads to track the agenda of topics that should be covered in
each track.<p>
<div id="PTGsessions">
<script id="PTGtemplate" type="text/x-handlebars-template">
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Etherpad links</h3></div>
<div class="panel-body">
{{#if eventid}}
<ul class="list-unstyled">
{{#each tracks as |track| }}
{{#if (lookup @root.etherpads track) }}
<a href="{{lookup @root.etherpads track}}">{{lookup @root.etherpads track}}</a>
<a href="{{@root.eventid}}-{{track}}">{{@root.eventid}}-{{track}}</a>
Missing eventid: can't generate unique etherpad links for this event.
<script src="jquery-1.9.1.min.js"></script>
<script src="handlebars-4.0.6.js"></script>
<script src="bootstrap-3.3.7.min.js"></script>
<script src="ptg.js"></script>

+ 1
- 0
html/index.html View File

@ -19,6 +19,7 @@
<li><a href="">event details, overall schedule, travel info, FAQs</a></li>
<li><a href="ptg.html">current/next topics and room schedule</a></li>
<li><a href="etherpads.html">reference list of track etherpads</a></li>
<li><a href="">instructions for interacting with the IRC bot</a></li>
<div id="ExtraLinks"></div>

+ 2
- 0
ptgbot/ View File

@ -311,6 +311,8 @@ class PTGBot(SASL, SSL,
self.notify(track, adverb, params)
elif adverb == 'clean':[track])
elif adverb == 'etherpad':, params)
elif adverb == 'color':, params)
elif adverb == 'location':

+ 9
- 0
ptgbot/ View File

@ -28,10 +28,12 @@ class PTGDataBase():
'slots': OrderedDict(),
'now': OrderedDict(),
'next': OrderedDict(),
'etherpads': OrderedDict(),
'colors': OrderedDict(),
'location': OrderedDict(),
'schedule': OrderedDict(),
'voice': 0,
'eventid': '',
'motd': {'message': '', 'level': 'info'},
'links': OrderedDict(),
# Keys for last_check_in are lower-cased nicks;
@ -80,6 +82,13 @@ class PTGDataBase():
def add_etherpad(self, track, etherpad):
if etherpad == 'auto':
else:['etherpads'][track] = etherpad
def add_color(self, track, color):['colors'][track] = color