runabot/RUNA/UI/AutoComplete.py
tmddn3070 6693186d40 FEAT: Inital commit
This Commit Contained Rebrand Patches
2024-03-17 09:42:36 +09:00

16 lines
440 B
Python

from discord import AutocompleteContext
from RUNA.Database.MeiliSearch import Snowball
async def Guild_Autocomplete(ctx: AutocompleteContext):
snowball = Snowball()
query = ctx.value
print(query)
result = await snowball.query_guild(query)
results = []
for i in result["hits"]:
gname = i["guild_name"]
gid = i["guild_id"]
results.append(f"{gname} ({gid})")
return results