Clean up combining new.channel and __init__ channel bootstrapping
This commit is contained in:
parent
5453b33d6e
commit
c958a5962d
1 changed files with 5 additions and 10 deletions
|
@ -51,24 +51,19 @@ class Module(object):
|
||||||
"duck?",
|
"duck?",
|
||||||
"validate": Utils.bool_or_none})
|
"validate": Utils.bool_or_none})
|
||||||
|
|
||||||
events.on("new.channel").hook(self.bootstrap)
|
events.on("new.channel").hook(self.new_channel)
|
||||||
|
|
||||||
|
|
||||||
events.on("received").on("message").on("channel").hook(
|
events.on("received").on("message").on("channel").hook(
|
||||||
self.channel_message, priority=2)
|
self.channel_message, priority=2)
|
||||||
|
|
||||||
self.bootstrap_lazy(events)
|
for server in self.bot.servers.values():
|
||||||
|
|
||||||
def bootstrap_lazy(self, event):
|
|
||||||
servers = self.bot.servers
|
|
||||||
|
|
||||||
for server in servers.values():
|
|
||||||
for channel in server.channels.values():
|
for channel in server.channels.values():
|
||||||
self.bootstrap(channel)
|
self.bootstrap(channel)
|
||||||
|
|
||||||
def bootstrap(self, event):
|
def new_channel(self, event):
|
||||||
channel = event["channel"] if hasattr(event, "channel") else event
|
self.bootstrap(event["channel"])
|
||||||
|
def bootstrap(self, channel):
|
||||||
self.init_game_var(channel)
|
self.init_game_var(channel)
|
||||||
# getset
|
# getset
|
||||||
ducks_enabled = channel.get_setting("ducks-enabled", False)
|
ducks_enabled = channel.get_setting("ducks-enabled", False)
|
||||||
|
|
Loading…
Reference in a new issue