bitbot-3.11-fork/modules/metadata.py
2019-05-19 11:08:32 +01:00

16 lines
544 B
Python

from src import IRCBot, ModuleManager, utils
CAP = utils.irc.Capability(None, "draft/metadata")
class Module(ModuleManager.BaseModule):
@utils.hook("received.cap.new")
@utils.hook("received.cap.ls")
def on_cap(self, event):
cap = CAP.copy()
if cap.available(event["capabilities"]):
cap.on_ack(lambda: self._ack(event["server"]))
return cap
def _ack(self, server):
url = self.bot.get_setting("bot-url", IRCBot.SOURCE)
server.send_raw("METADATA * SET bot-url :%s" % url)