add color command

Allow room managers to set the colors of rooms.

Change-Id: I252d52db0cdf6c25e7c9be95c0debb49bd983cbd
Signed-off-by: Doug Hellmann <>
Doug Hellmann 6 years ago
parent 985dd4bd0b
commit 9dc9d866ac

@ -21,6 +21,7 @@ You have to have voice in the channel (+v) to send commands to the ptgbot.
Commands follow the following format::
#ROOMNAME [now|next] TOPIC
Please note that:
@ -32,14 +33,23 @@ Please note that:
wipes out any "next" entry for the same room. You might want to refresh
those after entering a "now" topic.
* The color command only sets the background color for the room
name. The foreground is always white. Colors can be specified in any
form supported by the CSS attribute background-color.
#swift now discussing ring placement
#swift color blue
#swift next at 2pm we plan to discuss #glance support
#swift next around 3pm we plan to cover cold storage features
#swift now discussing #glance support, come over!
#swift next at 3pm we plan to cover cold storage features
#oslo now discussing oslo.config drivers
#oslo color #42f4c5
#oslo next after lunch we plan to discuss auto-generating config reference docs
You can also remove all entries related to your room by issuing the following

@ -16,12 +16,19 @@
<script id="PTGtemplate" type="text/x-handlebars-template">
{{#each colors as |color room|}}
.{{room}} {
background-color: {{color}};
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Currently playing...</h3></div>
<table class="table">
{{#each now}}
<td class="col-sm-1"><span class="label label-primary">{{@key}}</span></td>
<td class="col-sm-1"><span class="label label-primary {{@key}}">{{@key}}</span></td>
@ -34,7 +41,7 @@
<table class="table">
{{#each next as |sessions room|}}
<td class="col-sm-1"><span class="label label-primary">{{room}}</span></td>
<td class="col-sm-1"><span class="label label-primary {{room}}">{{room}}</span></td>
{{#each sessions}}

@ -135,6 +135,8 @@ class PTGBot(, session)
elif adverb == 'clean':[room])
elif adverb == 'color':, session)
self.send(chan, "%s: unknown directive '%s'" % (nick, adverb))

@ -21,7 +21,7 @@ import datetime
class PTGDataBase():
BASE = {'rooms': [], 'ethercalc': [], 'now': {}, 'next': {}}
BASE = {'rooms': [], 'ethercalc': [], 'now': {}, 'next': {}, 'colors': {}}
def __init__(self, filename, ethercalc):
self.filename = filename
@ -39,6 +39,10 @@ class PTGDataBase():
def add_color(self, room, color):['colors'][room] = color
def add_next(self, room, session):
if room not in['next']:['next'][room] = []