index : logbot | |
Archlinux32 log bot | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | logbot.py | 29 |
@@ -252,8 +252,6 @@ class Logbot(SingleServerIRCBot): def format_event(self, name, event, params): msg = self.format[name] - for key, val in params.items(): - msg = msg.format(key = val) try: user_message = event.arguments()[0] @@ -269,14 +267,15 @@ class Logbot(SingleServerIRCBot): host = event.source(), channel = event.target(), color = self.color(nm_to_n(event.source())), - message = html_color(user_message)) + message = html_color(user_message), + **params) return msg def write_event(self, name, event, params={}): # Format the event properly if name == 'nick' or name == 'quit': - chans = params["{chan}"] + chans = params["chan"] else: chans = event.target() msg = self.format_event(name, event, params) @@ -403,17 +402,17 @@ class Logbot(SingleServerIRCBot): def on_kick(self, c, e): self.write_event("kick", e, - {"{kicker}" : e.source(), - "{channel}" : e.target(), - "{user}" : e.arguments()[0], - "{reason}" : e.arguments()[1], + {"kicker" : e.source(), + "channel" : e.target(), + "user" : e.arguments()[0], + "reason" : e.arguments()[1], }) def on_mode(self, c, e): self.write_event("mode", e, - {"{modes}" : e.arguments()[0], - "{person}" : e.arguments()[1] if len(e.arguments()) > 1 else e.target(), - "{giver}" : nm_to_n(e.source()), + {"modes" : e.arguments()[0], + "person" : e.arguments()[1] if len(e.arguments()) > 1 else e.target(), + "giver" : nm_to_n(e.source()), }) def on_nick(self, c, e): @@ -422,9 +421,9 @@ class Logbot(SingleServerIRCBot): for chan in self.channels: if old_nick in [x.lstrip('~%&@+') for x in self.channels[chan].users()]: self.write_event("nick", e, - {"{old}" : old_nick, - "{new}" : e.target(), - "{chan}": chan, + {"old" : old_nick, + "new" : e.target(), + "chan": chan, }) def on_part(self, c, e): @@ -447,7 +446,7 @@ class Logbot(SingleServerIRCBot): # Only write the event on channels that actually had the user in the channel for chan in self.channels: if nick in [x.lstrip('~%&@+') for x in self.channels[chan].users()]: - self.write_event("quit", e, {"{chan}" : chan}) + self.write_event("quit", e, {"chan" : chan}) def on_topic(self, c, e): self.write_event("topic", e) |