WIP: Refactor Aurora (3.0.0) #29

Draft
cswimr wants to merge 347 commits from aurora-pydantic into main
Showing only changes of commit ad063062fb - Show all commits

View file

@ -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