tss db wipe and update (#1305)
This commit is contained in:
+6
-6
@@ -58,7 +58,7 @@ async def team_autocomplete(interaction: discord.Interaction, current: str) -> L
|
||||
return []
|
||||
choices = []
|
||||
for r in rows:
|
||||
label = (r.get("tag_name") or r.get("long_name") or str(r["team_id"]))[:100]
|
||||
label = (r.get("long_name") or str(r["team_id"]))[:100]
|
||||
choices.append(app_commands.Choice(name=label, value=str(r["team_id"])))
|
||||
return choices
|
||||
|
||||
@@ -112,7 +112,7 @@ class TssCommands(commands.Cog):
|
||||
|
||||
# ── /set-team ──────────────────────────────────────────────────────────
|
||||
@app_commands.command(name="set-team", description="Set this server's team")
|
||||
@app_commands.describe(team="Team name, tag, or ID")
|
||||
@app_commands.describe(team="TSS team name or ID")
|
||||
@app_commands.autocomplete(team=team_autocomplete)
|
||||
@app_commands.checks.has_permissions(manage_guild=True)
|
||||
@not_blacklisted()
|
||||
@@ -123,7 +123,7 @@ class TssCommands(commands.Cog):
|
||||
resolved = await storage.resolve_team(team)
|
||||
if not resolved:
|
||||
return await interaction.followup.send(f"Could not find a team matching **{team}**.", ephemeral=True)
|
||||
name = resolved.get("tag_name") or resolved.get("long_name") or str(resolved["team_id"])
|
||||
name = resolved.get("long_name") or str(resolved["team_id"])
|
||||
preferences.set_guild_team(interaction.guild_id, int(resolved["team_id"]), name)
|
||||
await interaction.followup.send(
|
||||
f"✅ This server's team is now **{name}** (id `{resolved['team_id']}`).", ephemeral=True
|
||||
@@ -131,7 +131,7 @@ class TssCommands(commands.Cog):
|
||||
|
||||
# ── /log-team ──────────────────────────────────────────────────────────
|
||||
@app_commands.command(name="log-team", description="Send a team's matches to this channel")
|
||||
@app_commands.describe(team="Team name, tag, or ID")
|
||||
@app_commands.describe(team="TSS team name or ID")
|
||||
@app_commands.autocomplete(team=team_autocomplete)
|
||||
@app_commands.checks.has_permissions(manage_guild=True)
|
||||
@not_blacklisted()
|
||||
@@ -142,7 +142,7 @@ class TssCommands(commands.Cog):
|
||||
resolved = await storage.resolve_team(team)
|
||||
if not resolved:
|
||||
return await interaction.followup.send(f"Could not find a team matching **{team}**.", ephemeral=True)
|
||||
name = resolved.get("tag_name") or resolved.get("long_name") or str(resolved["team_id"])
|
||||
name = resolved.get("long_name") or str(resolved["team_id"])
|
||||
preferences.upsert_log_entry(
|
||||
interaction.guild_id, int(resolved["team_id"]), "tss-team", name, interaction.channel_id
|
||||
)
|
||||
@@ -223,7 +223,7 @@ class TssCommands(commands.Cog):
|
||||
embed.add_field(
|
||||
name="Teams seen with",
|
||||
value="\n".join(
|
||||
f"`{(tm.get('team_tag') or '?')}` — {tm.get('games') or 0} games" for tm in top
|
||||
f"`{(tm.get('team_name') or '?')}` — {tm.get('games') or 0} games" for tm in top
|
||||
),
|
||||
inline=False,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user