feat(aurora): add autocomplete to /history
's types argument
This commit is contained in:
parent
830237938a
commit
ad063062fb
1 changed files with 16 additions and 0 deletions
|
@ -11,6 +11,7 @@ import os
|
||||||
import time
|
import time
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from math import ceil
|
from math import ceil
|
||||||
|
from typing import List
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from class_registry.registry import RegistryKeyError
|
from class_registry.registry import RegistryKeyError
|
||||||
|
@ -767,6 +768,21 @@ class Aurora(commands.Cog):
|
||||||
|
|
||||||
await interaction.followup.send(embed=embed, ephemeral=ephemeral)
|
await interaction.followup.send(embed=embed, ephemeral=ephemeral)
|
||||||
|
|
||||||
|
@history.autocomplete('types')
|
||||||
|
async def _history_types(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]:
|
||||||
|
types: List[str] = sorted(self.type_registry.keys())
|
||||||
|
choices = list()
|
||||||
|
if current.endswith(","):
|
||||||
|
for c in current.split(","):
|
||||||
|
if c in types:
|
||||||
|
types.remove(c)
|
||||||
|
for t in types:
|
||||||
|
choices.append(app_commands.Choice(name=current+t, value=current+t))
|
||||||
|
else:
|
||||||
|
for t in types:
|
||||||
|
choices.append(app_commands.Choice(name=t, value=t))
|
||||||
|
return choices[:25]
|
||||||
|
|
||||||
@app_commands.command(name="resolve")
|
@app_commands.command(name="resolve")
|
||||||
async def resolve(
|
async def resolve(
|
||||||
self, interaction: discord.Interaction, case: int, reason: str | None = None
|
self, interaction: discord.Interaction, case: int, reason: str | None = None
|
||||||
|
|
Loading…
Reference in a new issue