Fixed auto_complete #367

This commit is contained in:
Sven Heidemann 2023-09-25 22:10:17 +02:00
parent 74ddc238be
commit 4cc094576d

View File

@ -99,6 +99,15 @@ class SyncXpGroup(DiscordCommandABC):
await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.technician.synced_message"))
self._logger.trace(__name__, f"Finished sync xp command")
@all_members.autocomplete("server_id")
async def list_autocomplete(self, interaction: discord.Interaction, current: str) -> list[app_commands.Choice]:
return [
app_commands.Choice(name=server.name, value=server.id)
for server in self._client_utils.get_auto_complete_list(
self._servers.get_servers(), current, lambda x: x.name
)
]
@sync_xp.command(name="by_member")
@commands.guild_only()
@CommandChecks.check_is_ready()
@ -137,7 +146,7 @@ class SyncXpGroup(DiscordCommandABC):
await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.technician.synced_message"))
self._logger.trace(__name__, f"Finished sync xp command")
@sync_xp.autocomplete("server_id")
@by_member.autocomplete("server_id")
async def list_autocomplete(self, interaction: discord.Interaction, current: str) -> list[app_commands.Choice]:
return [
app_commands.Choice(name=server.name, value=server.id)