Bootstrap properly on module reload.

This commit is contained in:
dngfx 2018-09-08 21:58:32 +01:00 committed by dongfix
parent 558e2eb846
commit 3bdc43cf71

View file

@ -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