Added user remove command #23 #144

Merged
edraft merged 6 commits from #23 into 0.3 2022-12-23 15:50:08 +01:00
Showing only changes of commit d197a6e158 - Show all commits

View File

@ -224,3 +224,36 @@ class UserGroup(DiscordCommandABC):
async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]:
atr_list = [self._atr_dict["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:
# 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 it
await self._message_service.send_interaction_msg(
ctx.interaction,
self._t.transform(f'modules.base.user.remove.{atr}').format(member.mention, value)
)
@remove.autocomplete('atr')
async def remove_autocomplete(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]:
Ebola-Chan marked this conversation as resolved Outdated
Siehe anmerkung https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot/pulls/143
atr_list = ['xp', 'ontime']
return [app_commands.Choice(name=atr, value=atr) for atr in atr_list]