Merge "add color command"
This commit is contained in:
commit
5e441b866a
10
README.rst
10
README.rst
|
@ -21,6 +21,7 @@ You have to have voice in the channel (+v) to send commands to the ptgbot.
|
||||||
Commands follow the following format::
|
Commands follow the following format::
|
||||||
|
|
||||||
#ROOMNAME [now|next] TOPIC
|
#ROOMNAME [now|next] TOPIC
|
||||||
|
#ROOMNAME [color] CSS_COLOR_SPECIFIER
|
||||||
|
|
||||||
Please note that:
|
Please note that:
|
||||||
|
|
||||||
|
@ -32,14 +33,23 @@ Please note that:
|
||||||
wipes out any "next" entry for the same room. You might want to refresh
|
wipes out any "next" entry for the same room. You might want to refresh
|
||||||
those after entering a "now" topic.
|
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.
|
||||||
|
|
||||||
Example::
|
Example::
|
||||||
|
|
||||||
#swift now discussing ring placement
|
#swift now discussing ring placement
|
||||||
|
#swift color blue
|
||||||
#swift next at 2pm we plan to discuss #glance support
|
#swift next at 2pm we plan to discuss #glance support
|
||||||
#swift next around 3pm we plan to cover cold storage features
|
#swift next around 3pm we plan to cover cold storage features
|
||||||
...
|
...
|
||||||
#swift now discussing #glance support, come over!
|
#swift now discussing #glance support, come over!
|
||||||
#swift next at 3pm we plan to cover cold storage features
|
#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
|
You can also remove all entries related to your room by issuing the following
|
||||||
command::
|
command::
|
||||||
|
|
|
@ -16,12 +16,19 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script id="PTGtemplate" type="text/x-handlebars-template">
|
<script id="PTGtemplate" type="text/x-handlebars-template">
|
||||||
|
<style>
|
||||||
|
{{#each colors as |color room|}}
|
||||||
|
.{{room}} {
|
||||||
|
background-color: {{color}};
|
||||||
|
}
|
||||||
|
{{/each}}
|
||||||
|
</style>
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading"><h3 class="panel-title">Currently playing...</h3></div>
|
<div class="panel-heading"><h3 class="panel-title">Currently playing...</h3></div>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
{{#each now}}
|
{{#each now}}
|
||||||
<tr>
|
<tr>
|
||||||
<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>
|
||||||
<td>{{#hashtag}}{{this}}{{/hashtag}}</td>
|
<td>{{#hashtag}}{{this}}{{/hashtag}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@ -34,7 +41,7 @@
|
||||||
<table class="table">
|
<table class="table">
|
||||||
{{#each next as |sessions room|}}
|
{{#each next as |sessions room|}}
|
||||||
<tr>
|
<tr>
|
||||||
<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>
|
||||||
<td>
|
<td>
|
||||||
{{#each sessions}}
|
{{#each sessions}}
|
||||||
{{#hashtag}}{{this}}{{/hashtag}}<br/>
|
{{#hashtag}}{{this}}{{/hashtag}}<br/>
|
||||||
|
|
|
@ -135,6 +135,8 @@ class PTGBot(irc.bot.SingleServerIRCBot):
|
||||||
self.data.add_next(room, session)
|
self.data.add_next(room, session)
|
||||||
elif adverb == 'clean':
|
elif adverb == 'clean':
|
||||||
self.data.clean_rooms([room])
|
self.data.clean_rooms([room])
|
||||||
|
elif adverb == 'color':
|
||||||
|
self.data.add_color(room, session)
|
||||||
else:
|
else:
|
||||||
self.send(chan, "%s: unknown directive '%s'" % (nick, adverb))
|
self.send(chan, "%s: unknown directive '%s'" % (nick, adverb))
|
||||||
self.usage(chan)
|
self.usage(chan)
|
||||||
|
|
|
@ -21,7 +21,7 @@ import datetime
|
||||||
|
|
||||||
class PTGDataBase():
|
class PTGDataBase():
|
||||||
|
|
||||||
BASE = {'rooms': [], 'ethercalc': [], 'now': {}, 'next': {}}
|
BASE = {'rooms': [], 'ethercalc': [], 'now': {}, 'next': {}, 'colors': {}}
|
||||||
|
|
||||||
def __init__(self, filename, ethercalc):
|
def __init__(self, filename, ethercalc):
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
|
@ -39,6 +39,10 @@ class PTGDataBase():
|
||||||
del self.data['next'][room]
|
del self.data['next'][room]
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
|
def add_color(self, room, color):
|
||||||
|
self.data['colors'][room] = color
|
||||||
|
self.save()
|
||||||
|
|
||||||
def add_next(self, room, session):
|
def add_next(self, room, session):
|
||||||
if room not in self.data['next']:
|
if room not in self.data['next']:
|
||||||
self.data['next'][room] = []
|
self.data['next'][room] = []
|
||||||
|
|
Loading…
Reference in New Issue