From c44424b5a1c967b37f2171fd95e6916c8fce385d Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 2 Jun 2019 15:18:49 +0100 Subject: [PATCH] Track last-seen msgid per-channel (add msgid.py) --- modules/msgid.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 modules/msgid.py diff --git a/modules/msgid.py b/modules/msgid.py new file mode 100644 index 00000000..7edeed78 --- /dev/null +++ b/modules/msgid.py @@ -0,0 +1,13 @@ +from src import ModuleManager, utils + +TAG = utils.irc.MessageTag("msgid", "draft/msgid") + +class Module(ModuleManager.BaseModule): + @utils.hook("received.message.channel") + #TODO: catch CTCPs + @utils.hook("received.notice.channel") + @utils.hook("received.tagmsg.channel") + def on_channel(self, event): + msgid = TAG.get_value(event["tags"]) + if not msgid == None: + event["channel"].set_setting("last-msgid", msgid)