Utilise !serverset in more modules

This commit is contained in:
jesopo 2018-09-09 10:17:22 +01:00 committed by Dan
parent 2fa7d9b8a9
commit 8959b6cfd2
4 changed files with 14 additions and 1 deletions

View file

@ -1,10 +1,14 @@
import Utils
class Module(object):
def __init__(self, bot, events, exports):
events.on("received").on("invite").hook(self.on_invite)
exports.add("serverset", {"setting": "accept-invites",
"help": "Set whether I accept invites on this server",
"validate": Utils.bool_or_none})
def on_invite(self, event):
if event["server"].is_own_nickname(event["target_user"].nickname):
if event["server"].get_setting("accept-invites", True):
event["server"].send_join(event["target_channel"])

View file

@ -15,6 +15,9 @@ class Module(object):
exports.add("channelset", {"setting": "check-urls",
"help": "Enable/Disable automatically checking for "
"malicious URLs", "validate": Utils.bool_or_none})
exports.add("serverset", {"setting": "check-urls",
"help": "Enable/Disable automatically checking for "
"malicious URLs", "validate": Utils.bool_or_none})
exports.add("channelset", {"setting": "check-urls-kick",
"help": "Enable/Disable automatically kicking users that "
"send malicious URLs", "validate": Utils.bool_or_none})

View file

@ -70,6 +70,8 @@ class Module(object):
exports.add("channelset", {"setting": "command-prefix",
"help": "Set the command prefix used in this channel"})
exports.add("serverset", {"setting": "command-prefix",
"help": "Set the command prefix used on this server"})
exports.add("serverset", {"setting": "identity-mechanism",
"help": "Set the identity mechanism for this server"})

View file

@ -1,10 +1,14 @@
import datetime
import Utils
class Module(object):
def __init__(self, bot, events, exports):
self.bot = bot
events.on("received").on("message").on("private").hook(
self.private_message)
exports.add("serverset", {"setting": "ctcp-responses",
"help": "Set whether I respond to CTCPs on this server",
"validate": Utils.bool_or_none})
def private_message(self, event):
if event["message"][0] == "\x01" and event["message"][-1] == "\x01":