From 346c5f5400c610d06f6d4ff28b4474046c94525b Mon Sep 17 00:00:00 2001 From: kongr45gpen Date: Wed, 24 Jul 2013 18:18:12 +0300 Subject: Show more information on the messages And add some colour --- plugin.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'plugin.py') diff --git a/plugin.py b/plugin.py index 264c5d2..6b703cc 100644 --- a/plugin.py +++ b/plugin.py @@ -45,6 +45,10 @@ def plural(number, s, p): return p return s +# Possible colours: +# white, black, (light/dark) blue, (light) green, red, brown, purple, +# orange, yellow, teal, pink, light/dark gray/grey + class GithubHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_POST(s): @@ -67,12 +71,18 @@ class GithubHandler(BaseHTTPServer.BaseHTTPRequestHandler): msgs = [] commitno = len(data['commits']) - msgs.append( ircmsgs.privmsg("#main", "%s pushed %i %s, check them out" % - (data['pusher']['name'], + branch = data['ref'].split('/',2)[2] + + msgs.append( ircmsgs.privmsg("#main", "%s @ %s: %s pushed %i %s (%s)" % ( + ircutils.bold(ircutils.mircColor(branch, "blue")), + ircutils.bold(data['repository']['name']), + ircutils.mircColor(data['pusher']['name'], "green"), commitno, - plural(commitno, "commit", "commits"))) ) + plural(commitno, "commit", "commits"), + data['compare'] + )) ) - msgs.append( ircmsgs.privmsg("#main", "%s" % (data['compare'])) ) + #msgs.append( ircmsgs.privmsg("#main", "%s" % ()) ) for msg in msgs: irc.queueMsg(msg) -- cgit v1.2.3