aboutsummaryrefslogtreecommitdiff
path: root/modules/ircv3_server_time.py
blob: 31126b45fc7da79e97841eb3ee1aab82b2cdeb68 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from src import ModuleManager, utils

CAP = utils.irc.Capability("server-time")
TAG = utils.irc.MessageTag("time")

class Module(ModuleManager.BaseModule):
    @utils.hook("received.cap.ls")
    @utils.hook("received.cap.new")
    def on_cap(self, event):
        return CAP.copy()

    @utils.hook("raw.received")
    def raw_recv(self, event):
        server_time = TAG.get_value(event["line"].tags)
        if not server_time == None:
            event["server"].set_setting("last-server-time", server_time)