From 7cccb482b76f2c80cbb1266ce36f5fc4bc2961c5 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 15 May 2019 10:33:39 +0100 Subject: [PATCH] Add first version of metadata.py - for ircv3 draft/metadata --- modules/metadata.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 modules/metadata.py diff --git a/modules/metadata.py b/modules/metadata.py new file mode 100644 index 00000000..a98b66a2 --- /dev/null +++ b/modules/metadata.py @@ -0,0 +1,14 @@ +from src import ModuleManager, utils + +class Module(ModuleManager.BaseModule): + @utils.hook("received.cap.new") + @utils.hook("received.cap.ls") + def on_cap(self, event): + cap = utils.irc.Capability(None, "draft/metadata") + if cap.available(event["capabilities"]): + cap.on_ack(lambda: self._ack(event["server"])) + return cap + + def _cap(self, server): + url = self.bot.get_setting("bot-url", IRCBot.SOURCE) + server.send_raw("METADATA * SET bot-url :%s" % url)