2016-04-03 12:20:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Module(object):
|
|
|
|
def __init__(self, bot):
|
|
|
|
self.bot = bot
|
2016-04-03 16:08:48 +00:00
|
|
|
bot.events.on("boot").on("done").hook(self.boot_done)
|
2016-04-03 12:20:05 +00:00
|
|
|
bot.events.on("channel").on("mode").hook(self.on_mode)
|
|
|
|
bot.events.on("received").on("join").hook(self.on_join)
|
|
|
|
|
2016-04-03 12:23:47 +00:00
|
|
|
def validate_setchannel(self, s):
|
|
|
|
return s.lower() == "true"
|
|
|
|
def boot_done(self, event):
|
|
|
|
self.bot.events.on("postboot").on("configure").on(
|
|
|
|
"channelset").call(setting="automode",
|
|
|
|
help="Disable/Enable automode",
|
|
|
|
validate=self.validate_setchannel)
|
|
|
|
|
2016-04-03 12:20:05 +00:00
|
|
|
def on_mode(self, event):
|
2016-04-03 12:23:47 +00:00
|
|
|
if event["channel"].get_setting("automode", False):
|
2016-04-03 12:20:05 +00:00
|
|
|
remove = event["remove"]
|
|
|
|
channel = event["channel"]
|
|
|
|
mode = event["mode"]
|
|
|
|
args = event["args"]
|
|
|
|
|
|
|
|
def on_join(self, event):
|
2016-04-03 12:23:47 +00:00
|
|
|
if event["channel"].get_setting("automode", False):
|
2016-04-03 12:20:05 +00:00
|
|
|
pass
|