We need to pass a user object to _privmsg

This commit is contained in:
jesopo 2019-03-05 09:30:36 +00:00
parent 0a5ebd0cf4
commit 2750f29989

View file

@ -15,7 +15,7 @@ class Module(ModuleManager.BaseModule):
symbols.append(server.prefix_modes[mode]) symbols.append(server.prefix_modes[mode])
return "".join(symbols) return "".join(symbols)
def _privmsg(self, event, channel, nickname): def _privmsg(self, event, channel, user, nickname):
symbols = "" symbols = ""
if channel: if channel:
symbols = self._mode_symbols(user, channel, event["server"]) symbols = self._mode_symbols(user, channel, event["server"])
@ -28,11 +28,16 @@ class Module(ModuleManager.BaseModule):
@utils.hook("send.message.channel") @utils.hook("send.message.channel")
@utils.hook("received.message.channel") @utils.hook("received.message.channel")
def channel_message(self, event): def channel_message(self, event):
nickname = event["server"].nickname nickname = None
if "user" in event: user = None
if "user" in event and event["user"]:
user = event["user"]
nickname = event["user"].nickname nickname = event["user"].nickname
else:
nickname = event["server"].nickname
user = event["server"].get_user(nickname)
line = self._privmsg(event, event["channel"], nickname) line = self._privmsg(event, event["channel"], user, nickname)
self._event("message.channel", event["server"], line, self._event("message.channel", event["server"], line,
event["channel"].name) event["channel"].name)