Do format parsing (color, bold, etc) in format_activity.py

This commit is contained in:
jesopo 2019-03-06 08:08:20 +00:00
parent b549a28bed
commit b5b841033f
2 changed files with 4 additions and 7 deletions

View file

@ -3,8 +3,8 @@ from src import EventManager, ModuleManager, utils
class Module(ModuleManager.BaseModule):
def _event(self, type, server, line, context):
self.events.on("formatted").on(type).call(server=server, line=line,
context=context)
self.events.on("formatted").on(type).call(server=server,
context=context, line=utils.irc.parse_format(line))
def _mode_symbols(self, user, channel, server):
modes = channel.get_user_status(user)

View file

@ -2,10 +2,6 @@ import datetime
from src import EventManager, ModuleManager, utils
class Module(ModuleManager.BaseModule):
def _print_line(self, target, context, line):
formatted_line = utils.irc.parse_format(line)
self.bot.log.info("%s%s | %s", [target, context or "", formatted_line])
@utils.hook("formatted.message.channel")
@utils.hook("formatted.notice.channel")
@utils.hook("formatted.join")
@ -21,4 +17,5 @@ class Module(ModuleManager.BaseModule):
@utils.hook("formatted.rename")
@utils.hook("formatted.motd")
def formatted(self, event):
self._print_line(str(event["server"]), event["context"], event["line"])
self.bot.log.info("%s%s | %s", [
str(event["server"]), event["context"] or "", event["line"]])