Utilise !serverset in more modules
This commit is contained in:
parent
8b7cecda04
commit
fd51d44c70
4 changed files with 14 additions and 1 deletions
|
@ -1,10 +1,14 @@
|
||||||
|
import Utils
|
||||||
|
|
||||||
class Module(object):
|
class Module(object):
|
||||||
def __init__(self, bot, events, exports):
|
def __init__(self, bot, events, exports):
|
||||||
events.on("received").on("invite").hook(self.on_invite)
|
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):
|
def on_invite(self, event):
|
||||||
if event["server"].is_own_nickname(event["target_user"].nickname):
|
if event["server"].is_own_nickname(event["target_user"].nickname):
|
||||||
if event["server"].get_setting("accept-invites", True):
|
if event["server"].get_setting("accept-invites", True):
|
||||||
event["server"].send_join(event["target_channel"])
|
event["server"].send_join(event["target_channel"])
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@ class Module(object):
|
||||||
exports.add("channelset", {"setting": "check-urls",
|
exports.add("channelset", {"setting": "check-urls",
|
||||||
"help": "Enable/Disable automatically checking for "
|
"help": "Enable/Disable automatically checking for "
|
||||||
"malicious URLs", "validate": Utils.bool_or_none})
|
"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",
|
exports.add("channelset", {"setting": "check-urls-kick",
|
||||||
"help": "Enable/Disable automatically kicking users that "
|
"help": "Enable/Disable automatically kicking users that "
|
||||||
"send malicious URLs", "validate": Utils.bool_or_none})
|
"send malicious URLs", "validate": Utils.bool_or_none})
|
||||||
|
|
|
@ -70,6 +70,8 @@ class Module(object):
|
||||||
|
|
||||||
exports.add("channelset", {"setting": "command-prefix",
|
exports.add("channelset", {"setting": "command-prefix",
|
||||||
"help": "Set the command prefix used in this channel"})
|
"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",
|
exports.add("serverset", {"setting": "identity-mechanism",
|
||||||
"help": "Set the identity mechanism for this server"})
|
"help": "Set the identity mechanism for this server"})
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
import datetime
|
import datetime
|
||||||
|
import Utils
|
||||||
|
|
||||||
class Module(object):
|
class Module(object):
|
||||||
def __init__(self, bot, events, exports):
|
def __init__(self, bot, events, exports):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
events.on("received").on("message").on("private").hook(
|
events.on("received").on("message").on("private").hook(
|
||||||
self.private_message)
|
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):
|
def private_message(self, event):
|
||||||
if event["message"][0] == "\x01" and event["message"][-1] == "\x01":
|
if event["message"][0] == "\x01" and event["message"][-1] == "\x01":
|
||||||
|
|
Loading…
Reference in a new issue