Correctly get BitBot's own modes in modules/print_activity.py

This commit is contained in:
jesopo 2018-10-03 16:47:52 +01:00
parent 84ebe5351b
commit 04ab018048

View file

@ -16,22 +16,23 @@ class Module(ModuleManager.BaseModule):
symbols.append(server.prefix_modes[mode]) symbols.append(server.prefix_modes[mode])
return "".join(symbols) return "".join(symbols)
def _on_message(self, event, nickname): def _on_message(self, event, user):
symbols = self._mode_symbols(event["user"], event["channel"], symbols = self._mode_symbols(user, event["channel"],
event["server"]) event["server"])
if event["action"]: if event["action"]:
self.print_line(event, "* %s%s %s" % (symbols, nickname, self.print_line(event, "* %s%s %s" % (symbols, user.nickname,
event["message"]), channel=event["channel"].name) event["message"]), channel=event["channel"].name)
else: else:
self.print_line(event, "<%s%s> %s" % (symbols, nickname, self.print_line(event, "<%s%s> %s" % (symbols, user.nickname,
event["message"]), channel=event["channel"].name) event["message"]), channel=event["channel"].name)
@utils.hook("received.message.channel", @utils.hook("received.message.channel",
priority=EventManager.PRIORITY_HIGH) priority=EventManager.PRIORITY_HIGH)
def channel_message(self, event): def channel_message(self, event):
self._on_message(event, event["user"].nickname) self._on_message(event, event["user"])
@utils.hook("self.message.channel") @utils.hook("self.message.channel")
def self_channel_message(self, event): def self_channel_message(self, event):
self._on_message(event, event["server"].nickname) self._on_message(event, event["server"].get_user(
event["server"].nickname))
def _on_notice(self, event, target): def _on_notice(self, event, target):
self.print_line(event, "(notice->%s) <%s> %s" % ( self.print_line(event, "(notice->%s) <%s> %s" % (