mirror of
https://github.com/insertapp/mmolbbot.git
synced 2025-07-01 22:37:04 +00:00
feat: autocorrect part 2
This commit is contained in:
parent
6b244f2fab
commit
84b5eab914
1 changed files with 16 additions and 1 deletions
17
cogs/team.py
17
cogs/team.py
|
@ -351,8 +351,11 @@ class team(commands.Cog):
|
||||||
],
|
],
|
||||||
force_global=True,
|
force_global=True,
|
||||||
)
|
)
|
||||||
async def teamstats(self, interaction: nextcord.Interaction, teamid: str):
|
async def teamstats(self, interaction: nextcord.Interaction, team: str):
|
||||||
|
if team not in teams_dict:
|
||||||
|
await interaction.response.send_message("Invalid Team!", ephemeral=True)
|
||||||
await interaction.response.defer()
|
await interaction.response.defer()
|
||||||
|
teamid = teams_dict[team]
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
stats = await loop.run_in_executor(None, teamstats,teamid)
|
stats = await loop.run_in_executor(None, teamstats,teamid)
|
||||||
splistats = [stats[i:i+1900] for i in range(0, len(stats), 1900)] #TODO make better as in don't do cutoff
|
splistats = [stats[i:i+1900] for i in range(0, len(stats), 1900)] #TODO make better as in don't do cutoff
|
||||||
|
@ -361,6 +364,18 @@ class team(commands.Cog):
|
||||||
for i in splistats:
|
for i in splistats:
|
||||||
await interaction.followup.send(f"```ansi\n{i}```")
|
await interaction.followup.send(f"```ansi\n{i}```")
|
||||||
|
|
||||||
|
@teamstats.on_autocomplete("team")
|
||||||
|
async def teamstatsac(self, interaction: nextcord.Interaction, team: str):
|
||||||
|
if not team:
|
||||||
|
print("we're here")
|
||||||
|
thanksdiscord = teams_list[:20]
|
||||||
|
await interaction.response.send_autocomplete(thanksdiscord)
|
||||||
|
return
|
||||||
|
closestteam = [name for name in teams_list if name.lower().startswith(team.lower())]
|
||||||
|
thanksdiscord = closestteam[:20]
|
||||||
|
await interaction.response.send_autocomplete(thanksdiscord)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@tasks.loop(hours=1)
|
@tasks.loop(hours=1)
|
||||||
async def updateallteams(self):
|
async def updateallteams(self):
|
||||||
|
|
Loading…
Reference in a new issue