From b2087042bc95f65253c5dd43794453164628255f Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Fri, 11 Nov 2022 07:33:24 +0100 Subject: [PATCH] Added error notification to level edit #103 --- kdb-bot/src/bot/translation/de.json | 2 ++ kdb-bot/src/modules/level/command/level_group.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/kdb-bot/src/bot/translation/de.json b/kdb-bot/src/bot/translation/de.json index ba857845..b3bbf9eb 100644 --- a/kdb-bot/src/bot/translation/de.json +++ b/kdb-bot/src/bot/translation/de.json @@ -196,6 +196,8 @@ }, "edit": { "edited": "Level {} wurde bearbeitet :D", + "color_invalid": "Die Farbe {} ist ungültig!", + "permission_invalid": "Der Berechtigungswert {} ist ungültig!", "not_found": "Level {} nicht gefunden!" }, "remove": { diff --git a/kdb-bot/src/modules/level/command/level_group.py b/kdb-bot/src/modules/level/command/level_group.py index 27fff87a..c8253a2c 100644 --- a/kdb-bot/src/modules/level/command/level_group.py +++ b/kdb-bot/src/modules/level/command/level_group.py @@ -229,6 +229,7 @@ class LevelGroup(DiscordCommandABC): try: level_from_db.color = hex(discord.Colour.from_str(color).value) except Exception as e: + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.edit.color_invalid').format(color)) self._logger.error(__name__, f'Error parsing color {color}', e) return @@ -239,6 +240,7 @@ class LevelGroup(DiscordCommandABC): try: level_from_db.permissions = discord.Permissions(permissions).value except Exception as e: + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.edit.permission_invalid').format(permissions)) self._logger.error(__name__, f'Error parsing permissions {permissions}', e) return