Improved dynamic modules support

This commit is contained in:
2021-11-15 21:52:28 +01:00
parent 4763c41b10
commit f2ee3d64f6
7 changed files with 40 additions and 21 deletions

View File

@@ -22,13 +22,12 @@ class BotService(BotServiceABC, commands.Bot):
commands.Bot.__init__(self, command_prefix=bot_settings.prefix, help_command=None)
async def start_async(self):
self._logger.trace(__name__, 'Loading modules:')
self._modules.start_modules()
self._logger.trace(__name__, 'Finished loading modules')
self._logger.trace(__name__, 'Try to connect to discord')
self.run(self._discord_settings.token)
# continue at on_ready
async def on_ready(self):
await self._modules.start_modules()
async def stop_async(self):
try:
@@ -36,3 +35,4 @@ class BotService(BotServiceABC, commands.Bot):
# save data
except Exception as e:
self._logger.error(__name__, 'Stop failed', e)