Bootstrap properly on module reload.
This commit is contained in:
parent
558e2eb846
commit
3bdc43cf71
1 changed files with 11 additions and 1 deletions
|
@ -53,11 +53,21 @@ class Module(object):
|
||||||
|
|
||||||
events.on("new.channel").hook(self.bootstrap)
|
events.on("new.channel").hook(self.bootstrap)
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
|
def bootstrap_lazy(self, event):
|
||||||
|
servers = self.bot.servers
|
||||||
|
|
||||||
|
for server in servers.values():
|
||||||
|
for channel in server.channels.values():
|
||||||
|
self.bootstrap(channel)
|
||||||
|
|
||||||
def bootstrap(self, event):
|
def bootstrap(self, event):
|
||||||
channel = event["channel"]
|
channel = event["channel"] if hasattr(event, "channel") else event
|
||||||
|
|
||||||
self.init_game_var(channel)
|
self.init_game_var(channel)
|
||||||
# getset
|
# getset
|
||||||
|
|
Loading…
Reference in a new issue