Added translation for user set command

This commit is contained in:
Nick Jungmann 2022-12-11 14:18:31 +01:00
parent ec30069ff5
commit cf610b770b
2 changed files with 8 additions and 9 deletions

View File

@ -177,9 +177,15 @@
"footer": "" "footer": ""
}, },
"get": { "get": {
"atr_not_found": "Das Attribut {} konnte nicht gefunden werden :(",
"xp": "{} hat {} xp", "xp": "{} hat {} xp",
"ontime": "{} war insgesamt {} Stunden aktiv in einem Sprachkanal" "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 :("
} }
} }
}, },

View File

@ -158,7 +158,7 @@ class UserGroup(DiscordCommandABC):
)) ))
case other: 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 return
await self._message_service.send_interaction_msg( 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): 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}') 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): if member is None or not isinstance(member, discord.Member):
member = ctx.author member = ctx.author
@ -196,17 +192,14 @@ class UserGroup(DiscordCommandABC):
self._db.save_changes() self._db.save_changes()
except Exception as e: except Exception as e:
await self._logger.trace(__name__, f'Value couldn\'t be converted to int\n'+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')) await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform('modules.base.user.error.value_type'))
return return
case other: case other:
# ToDo: Move atr_not_found
await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform( await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform(
'modules.base.user.error.atr_not_found').format(atr)) 'modules.base.user.error.atr_not_found').format(atr))
return return
# ToDo: Add text for set
await self._message_service.send_interaction_msg( await self._message_service.send_interaction_msg(
ctx.interaction, ctx.interaction,
self._t.transform(f'modules.base.user.set.{atr}').format(member.mention, value) self._t.transform(f'modules.base.user.set.{atr}').format(member.mention, value)