colorize nicks on JOIN formatting

This commit is contained in:
jesopo 2019-11-11 12:49:45 +00:00
parent b7bfd414be
commit 8a8bd8a77e
2 changed files with 8 additions and 2 deletions

View file

@ -82,8 +82,10 @@ class Module(ModuleManager.BaseModule):
event["user"].nickname)
def _on_join(self, event, user):
line = "- %s joined %s" % (user.hostmask(), event["channel"].name)
minimal_line = "%s joined %s" % (user.nickname, event["channel"].name)
nickname = self._colorize(user.nickname)
hostmask = "%s!%s" % (nickname, user.userhost())
line = "- %s joined %s" % (hostmask, event["channel"].name)
minimal_line = "%s joined %s" % (nickname, event["channel"].name)
self._event("join", event["server"], line, event["channel"].name,
channel=event["channel"], user=user, minimal=minimal_line)

View file

@ -36,6 +36,10 @@ class User(IRCObject.Object):
if self.nickname and self.username and self.hostname:
return "%s!%s@%s" % (self.nickname, self.username, self.hostname)
return None
def userhost(self) -> typing.Optional[str]:
if self.username and self.hostname:
return "%s@%s" % (self.username, self.hostname)
return None
def get_id(self)-> int:
return (self.identified_account_id_override or