2019-05-15 10:19:40 +00:00
|
|
|
from src import IRCBot, ModuleManager, utils
|
2019-05-15 09:33:39 +00:00
|
|
|
|
2019-06-21 16:15:46 +00:00
|
|
|
CAP = utils.irc.Capability(None, "draft/metadata", alias="metadata")
|
2019-05-19 10:08:32 +00:00
|
|
|
|
2019-05-15 09:33:39 +00:00
|
|
|
class Module(ModuleManager.BaseModule):
|
|
|
|
@utils.hook("received.cap.new")
|
|
|
|
@utils.hook("received.cap.ls")
|
|
|
|
def on_cap(self, event):
|
2019-05-19 10:08:32 +00:00
|
|
|
cap = CAP.copy()
|
2019-06-16 14:33:20 +00:00
|
|
|
cap.on_ack(lambda: self._ack(event["server"]))
|
|
|
|
return cap
|
2019-05-15 09:33:39 +00:00
|
|
|
|
2019-05-15 10:11:12 +00:00
|
|
|
def _ack(self, server):
|
2019-05-15 09:33:39 +00:00
|
|
|
url = self.bot.get_setting("bot-url", IRCBot.SOURCE)
|
2019-05-28 09:28:48 +00:00
|
|
|
server.send_raw("METADATA * SET bot BitBot")
|
|
|
|
server.send_raw("METADATA * SET homepage :%s" % url)
|