aboutsummaryrefslogtreecommitdiff
path: root/modules/print_activity.py
blob: fe8f0edf62966a3979d33db9d53cc8b6ca701498 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import datetime
from src import EventManager, ModuleManager, utils

DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"

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")
    @utils.hook("formatted.part")
    @utils.hook("formatted.nick")
    @utils.hook("formatted.server-notice")
    @utils.hook("formatted.invite")
    @utils.hook("formatted.mode.channel")
    @utils.hook("formatted.topic")
    @utils.hook("formatted.topic-timestamp")
    @utils.hook("formatted.kick")
    @utils.hook("formatted.quit")
    @utils.hook("formatted.rename")
    @utils.hook("formatted.motd")
    def formatted(self, event):
        self._print_line(str(event["server"]), event["context"], event["line"])