Update config when join a new guild

This commit is contained in:
louis chauvet 2018-09-01 20:43:34 +02:00
parent e7a1a3bbb3
commit 45eb1419c4

View File

@ -81,6 +81,7 @@ class Guild:
self.modules = [] self.modules = []
self.load_config() self.load_config()
self.update_modules() self.update_modules()
self.save_config()
def load_config(self): def load_config(self):
if self.bot.fileSystem.exists(self.config_file): if self.bot.fileSystem.exists(self.config_file):
@ -211,6 +212,11 @@ class FoBot(discord.Client):
async def on_resumed(self): async def on_resumed(self):
info("foBot is resumed.") info("foBot is resumed.")
async def on_guild_join(self, guild):
self.load_modules()
self.load_config()
self.save_config()
async def on_error(self, event, *args, **kwargs): async def on_error(self, event, *args, **kwargs):
error("foBot encounter an error.", exc_info=True) error("foBot encounter an error.", exc_info=True)
if os.environ.get("DROPBOX_ACCESS_TOKEN", False): if os.environ.get("DROPBOX_ACCESS_TOKEN", False):