bitbot-3.11-fork/modules/ctcp.py

30 lines
1 KiB
Python
Raw Normal View History

#--depends-on config
2016-03-31 11:10:51 +00:00
import datetime
from src import IRCBot, ModuleManager, utils
2016-03-29 11:56:58 +00:00
@utils.export("serverset", utils.BoolSetting("ctcp-responses",
"Set whether I respond to CTCPs on this server"))
class Module(ModuleManager.BaseModule):
@utils.hook("received.ctcp.request.version")
def ctcp_version(self, event):
2019-05-15 09:30:36 +00:00
default = "BitBot %s (%s)" % (IRCBot.VERSION, IRCBot.SOURCE)
event["user"].send_ctcp_response("VERSION",
2019-05-15 09:30:36 +00:00
self.bot.config.get("ctcp-version", default))
@utils.hook("received.ctcp.request.source")
def ctcp_source(self, event):
event["user"].send_ctcp_response("SOURCE",
2019-05-15 09:30:36 +00:00
self.bot.config.get("ctcp-source", IRCBot.SOURCE))
2016-03-29 11:56:58 +00:00
@utils.hook("received.ctcp.request.ping")
def ctcp_ping(self, event):
event["user"].send_ctcp_response("PING", event["message"])
2016-03-29 11:56:58 +00:00
@utils.hook("received.ctcp.request.time")
def ctcp_time(self, event):
event["user"].send_ctcp_response("TIME",
datetime.datetime.now().strftime("%c"))