Add IRCBot.SOURCE, use it in ctcp.py

This commit is contained in:
jesopo 2019-05-15 10:30:36 +01:00
parent 5ca9ae550d
commit a80eda614d
2 changed files with 5 additions and 4 deletions

View file

@ -1,8 +1,6 @@
import datetime
from src import IRCBot, ModuleManager, utils
VERSION_DEFAULT = "BitBot %s (https://git.io/bitbot)" % IRCBot.VERSION
SOURCE_DEFAULT = "https://git.io/bitbot"
@utils.export("serverset", {"setting": "ctcp-responses",
"help": "Set whether I respond to CTCPs on this server",
@ -10,13 +8,15 @@ SOURCE_DEFAULT = "https://git.io/bitbot"
class Module(ModuleManager.BaseModule):
@utils.hook("received.ctcp.version.private")
def ctcp_version(self, event):
default = "BitBot %s (%s)" % (IRCBot.VERSION, IRCBot.SOURCE)
event["user"].send_ctcp_response("VERSION",
self.bot.config.get("ctcp-version", VERSION_DEFAULT))
self.bot.config.get("ctcp-version", default))
@utils.hook("received.ctcp.source.private")
def ctcp_source(self, event):
event["user"].send_ctcp_response("SOURCE",
self.bot.config.get("ctcp-source", SOURCE_DEFAULT))
self.bot.config.get("ctcp-source", IRCBot.SOURCE))
@utils.hook("received.ctcp.ping.private")
def ctcp_ping(self, event):

View file

@ -3,6 +3,7 @@ from src import EventManager, Exports, IRCServer, Logging, ModuleManager
from src import Socket, utils
VERSION = "v1.5.0"
SOURCE = "https://git.io/bitbot"
class TriggerResult(enum.Enum):
Return = 1