aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2018-09-08 22:01:47 +0100
committerGravatar Dan2018-09-08 22:51:56 +0100
commit22ee129ca68db97fe8c72a6754e438dff79f8d78 (patch)
treef2f369eb8c8640b9ed34b81026c5c1e080896cf4 /modules
parentBootstrap properly on module reload. (diff)
signature
Clean up combining new.channel and __init__ channel bootstrapping
Diffstat (limited to 'modules')
-rw-r--r--modules/ducks.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/modules/ducks.py b/modules/ducks.py
index 3881aaf8..bfa676fc 100644
--- a/modules/ducks.py
+++ b/modules/ducks.py
@@ -51,24 +51,19 @@ class Module(object):
"duck?",
"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(
self.channel_message, priority=2)
- self.bootstrap_lazy(events)
-
- def bootstrap_lazy(self, event):
- servers = self.bot.servers
-
- for server in servers.values():
+ for server in self.bot.servers.values():
for channel in server.channels.values():
self.bootstrap(channel)
- def bootstrap(self, event):
- channel = event["channel"] if hasattr(event, "channel") else event
-
+ def new_channel(self, event):
+ self.bootstrap(event["channel"])
+ def bootstrap(self, channel):
self.init_game_var(channel)
# getset
ducks_enabled = channel.get_setting("ducks-enabled", False)