From c632ad51d4e2a614e1187a03f6ccaa822f87f741 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 9 Nov 2022 19:33:45 +0100 Subject: [PATCH] Fixed stuff caused by merges #26 --- kdb-bot/src/bot/translation/de.json | 10 +++++----- .../src/modules/level/command/level_group.py | 20 ++++++++++--------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/kdb-bot/src/bot/translation/de.json b/kdb-bot/src/bot/translation/de.json index ecc7359ad5..0aa1395eec 100644 --- a/kdb-bot/src/bot/translation/de.json +++ b/kdb-bot/src/bot/translation/de.json @@ -62,7 +62,7 @@ "gold": "Gold", "green": "Grün", "greyple": "Graugrün", - "light_gray": "Hellgrau", + "light_grey": "Hellgrau", "magenta": "Magenta", "orange": "Orange", "purple": "Violett", @@ -175,6 +175,9 @@ }, "level": { "new_level_message": "<@{}> ist nun Level {}", + "seeding_started": "Levelsystem wird neu geladen.", + "seeding_failed": "Levelsystem konnte nicht neu geladen werden.", + "seeding_finished": "Levelsystem wurde Erfolgreich neu geladen.", "error": { "nothing_found": "Keine Level Einträge gefunden.", "level_with_name_already_exists": "Ein Level mit dem Namen {} existiert bereits!", @@ -188,10 +191,7 @@ "permission_int": "Berechtigungen" }, "create": { - "created": "Level {} mit Berechtigungen {} wurde erstellt.", - "seeding_started": "Levelsystem wird neu geladen.", - "seeding_failed": "Levelsystem konnte nicht neu geladen werden.", - "seeding_finished": "Levelsystem wurde Erfolgreich neu geladen." + "created": "Level {} mit Berechtigungen {} wurde erstellt." }, "remove": { "success": "Level {} wurde entfernt :D", diff --git a/kdb-bot/src/modules/level/command/level_group.py b/kdb-bot/src/modules/level/command/level_group.py index da59dbb684..c024dbe37d 100644 --- a/kdb-bot/src/modules/level/command/level_group.py +++ b/kdb-bot/src/modules/level/command/level_group.py @@ -57,6 +57,16 @@ class LevelGroup(DiscordCommandABC): self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}') + async def _seed_levels(self, channel: discord.TextChannel): + # send message to ctx.channel because send_ctx_msg resolves ctx + try: + await self._message_service.send_channel_message(channel, self._t.transform('modules.level.seeding_started')) + await self._level_seeder.seed() + await self._message_service.send_channel_message(channel, self._t.transform('modules.level.seeding_finished')) + except Exception as e: + self._logger.error(__name__, f'Level seeding failed', e) + await self._message_service.send_channel_message(channel, self._t.transform('modules.level.seeding_failed')) + @commands.hybrid_group() @commands.guild_only() async def level(self, ctx: Context): @@ -146,15 +156,7 @@ class LevelGroup(DiscordCommandABC): self._logger.error(__name__, f'Could not save level {name} with color {color}, min_xp {min_xp} and permissions {permissions}', e) else: await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.create.created').format(name, permissions)) - - # send message to ctx.channel because send_ctx_msg resolves ctx - try: - await self._message_service.send_channel_message(ctx.channel, self._t.transform('modules.level.create.seeding_started')) - await self._level_seeder.seed() - await self._message_service.send_channel_message(ctx.channel, self._t.transform('modules.level.create.seeding_finished')) - except Exception as e: - self._logger.error(__name__, f'Level seeding failed', e) - await self._message_service.send_channel_message(ctx.channel, self._t.transform('modules.level.create.seeding_failed')) + await self._seed_levels(ctx.channel) self._logger.trace(__name__, f'Finished command level create')