From ab2145d5df09f76875524428178e0fa66f4ea5fb Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Thu, 17 Nov 2022 19:31:57 +0100 Subject: [PATCH] Check level for each member after changes #123 --- kdb-bot/src/bot/config | 2 +- kdb-bot/src/modules/level/level_seeder.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/kdb-bot/src/bot/config b/kdb-bot/src/bot/config index bd8d3a5d..c8e3ac09 160000 --- a/kdb-bot/src/bot/config +++ b/kdb-bot/src/bot/config @@ -1 +1 @@ -Subproject commit bd8d3a5dad13e0fdcad79b767c032997b716b1a4 +Subproject commit c8e3ac096317cfdafe809398a80cf659189d42a5 diff --git a/kdb-bot/src/modules/level/level_seeder.py b/kdb-bot/src/modules/level/level_seeder.py index 8e6eb9e7..2708324c 100644 --- a/kdb-bot/src/modules/level/level_seeder.py +++ b/kdb-bot/src/modules/level/level_seeder.py @@ -10,16 +10,26 @@ from bot_data.model.level import Level from bot_data.model.server import Server from bot_data.service.level_repository_service import LevelRepositoryService from modules.level.configuration.default_level_settings import DefaultLevelSettings +from modules.level.service.level_service import LevelService class LevelSeeder(DataSeederABC): - def __init__(self, logger: DatabaseLogger, levels: DefaultLevelSettings, level_repo: LevelRepositoryService, servers: ServerRepositoryABC, bot: DiscordBotServiceABC): + def __init__( + self, + logger: DatabaseLogger, + levels: DefaultLevelSettings, + level_repo: LevelRepositoryService, + servers: ServerRepositoryABC, + level: LevelService, + bot: DiscordBotServiceABC + ): DataSeederABC.__init__(self) self._logger = logger self._levels = level_repo self._servers = servers + self._level = level self._bot = bot self._level_header = levels.level_header @@ -87,4 +97,7 @@ class LevelSeeder(DataSeederABC): except Exception as e: self._logger.error(__name__, f'Cannot change position of {role.name}', e) + for m in guild.members: + await self._level.check_level(m) + self._logger.debug(__name__, f'Checked role order') -- 2.45.2