added some more to the skeleton of the auto_mode module.

This commit is contained in:
jesopo 2016-04-03 13:23:47 +01:00
parent 504e93a78d
commit e10ba5f293
No known key found for this signature in database
GPG key ID: 0BBDEB2AEFCFFCB3

View file

@ -3,16 +3,25 @@
class Module(object): class Module(object):
def __init__(self, bot): def __init__(self, bot):
self.bot = bot self.bot = bot
bot.events.on("boot").on("done").hook(self.book_done)
bot.events.on("channel").on("mode").hook(self.on_mode) bot.events.on("channel").on("mode").hook(self.on_mode)
bot.events.on("received").on("join").hook(self.on_join) bot.events.on("received").on("join").hook(self.on_join)
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)
def on_mode(self, event): def on_mode(self, event):
if event["channel"].get_setting("auto-mode", False): if event["channel"].get_setting("automode", False):
remove = event["remove"] remove = event["remove"]
channel = event["channel"] channel = event["channel"]
mode = event["mode"] mode = event["mode"]
args = event["args"] args = event["args"]
def on_join(self, event): def on_join(self, event):
if event["channel"].get_setting("auto-mode", False): if event["channel"].get_setting("automode", False):
pass pass