Compare commits

...

2 Commits

Author SHA1 Message Date
701fa21c64 Added translation for user remove command 2022-12-11 14:34:42 +01:00
b6f2ed464f Added user remove command 2022-12-11 14:34:42 +01:00
2 changed files with 35 additions and 0 deletions

View File

@ -183,6 +183,10 @@
"set": {
"xp": "{} hat nun {} xp"
},
"remove": {
"xp": "Die {} von {} wurden entfernt",
"ontime": "Die {} von {} wurden entfernt"
},
"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

@ -202,3 +202,34 @@ class UserGroup(DiscordCommandABC):
async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]:
atr_list = ['xp']
return [app_commands.Choice(name=atr, value=atr) for atr in atr_list]
async def remove(self, ctx: context, atr: str, member: discord.Member = none):
self._logger.debug(__name__, f'Received command user-remove {ctx}:{member}')
if member is None or not isinstance(member, discord.Member):
member = ctx.author
server = self._servers.find_server_by_discord_id(ctx.guild.id)
user = self._users.find_user_by_discord_id_and_server_id(member.id, server.server_id)
match atr:
case 'xp':
user.xp = 0
case 'ontime':
# ToDo: SQL-Statement to delete all records for dcUser in user_joined_voice_channel
return
case other:
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(
ctx.interaction,
self._t.transform(f'modules.base.user.remove.{atr}').format(value, member.mention)
)
@remove.autocomplete('atr')
async def remove_autocomplete(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]:
atr_list = ['xp', 'ontime']
return [app_commands.Choice(name=atr, value=atr) for atr in atr_list]