From cf610b770b71a74efa419e624603f856066d6bac Mon Sep 17 00:00:00 2001 From: Nick Jungmann Date: Sun, 11 Dec 2022 14:18:31 +0100 Subject: [PATCH] Added translation for user set command --- kdb-bot/src/bot/translation/de.json | 8 +++++++- kdb-bot/src/modules/base/command/user_group.py | 9 +-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/kdb-bot/src/bot/translation/de.json b/kdb-bot/src/bot/translation/de.json index 2c88a59e..01809096 100644 --- a/kdb-bot/src/bot/translation/de.json +++ b/kdb-bot/src/bot/translation/de.json @@ -177,9 +177,15 @@ "footer": "" }, "get": { - "atr_not_found": "Das Attribut {} konnte nicht gefunden werden :(", "xp": "{} hat {} xp", "ontime": "{} war insgesamt {} Stunden aktiv in einem Sprachkanal" + }, + "set": { + "xp": "{} hat nun {} xp" + }, + "error": { + "atr_not_found": "Das Attribut {} konnte nicht gefunden werden :(", + "value_type": "Der angegebende Wert konnte nicht für das Attribut interpretiert werden :(" } } }, diff --git a/kdb-bot/src/modules/base/command/user_group.py b/kdb-bot/src/modules/base/command/user_group.py index 171e713e..3fa0b81e 100644 --- a/kdb-bot/src/modules/base/command/user_group.py +++ b/kdb-bot/src/modules/base/command/user_group.py @@ -158,7 +158,7 @@ class UserGroup(DiscordCommandABC): )) case other: - await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform('modules.base.user.get.atr_not_found').format(atr)) + await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform('modules.base.user.error.atr_not_found').format(atr)) return await self._message_service.send_interaction_msg( @@ -178,10 +178,6 @@ class UserGroup(DiscordCommandABC): async def set(self, ctx: Context, atr: str, value: str, member: discord.Member = None): self._logger.debug(__name__, f'Received command user-set {ctx}:{member}') - if value == '': - await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform('modules.base.user.set.error.no_value')) - return - if member is None or not isinstance(member, discord.Member): member = ctx.author @@ -196,17 +192,14 @@ class UserGroup(DiscordCommandABC): self._db.save_changes() except Exception as e: await self._logger.trace(__name__, f'Value couldn\'t be converted to int\n'+e) - # ToDo: Add text for this exception await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform('modules.base.user.error.value_type')) return case other: - # ToDo: Move atr_not_found await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform( 'modules.base.user.error.atr_not_found').format(atr)) return - # ToDo: Add text for set await self._message_service.send_interaction_msg( ctx.interaction, self._t.transform(f'modules.base.user.set.{atr}').format(member.mention, value)