-am (#1329)
This commit is contained in:
+25
-1
@@ -150,6 +150,29 @@ class TssCommands(commands.Cog):
|
||||
f"✅ Logging **{name}**'s matches to <#{interaction.channel_id}>.", ephemeral=True
|
||||
)
|
||||
|
||||
# ── /log-player ────────────────────────────────────────────────────────
|
||||
@app_commands.command(name="log-player", description="Send a player's matches to this channel")
|
||||
@app_commands.describe(player="Player username")
|
||||
@app_commands.autocomplete(player=player_autocomplete)
|
||||
@app_commands.checks.has_permissions(manage_guild=True)
|
||||
@not_blacklisted()
|
||||
async def log_player(self, interaction: discord.Interaction, player: str):
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
if interaction.guild_id is None or interaction.channel_id is None:
|
||||
return await interaction.followup.send("This command must be used in a server channel.", ephemeral=True)
|
||||
candidates = await storage.resolve_players(player)
|
||||
if not candidates:
|
||||
return await interaction.followup.send(f"No players found matching **{player}**.", ephemeral=True)
|
||||
if len(candidates) > 1:
|
||||
return await interaction.followup.send(_too_many_msg(candidates), ephemeral=True)
|
||||
uid, nick = str(candidates[0]["uid"]), candidates[0]["nick"]
|
||||
preferences.upsert_log_entry(
|
||||
interaction.guild_id, uid, "tss-player", nick, interaction.channel_id
|
||||
)
|
||||
await interaction.followup.send(
|
||||
f"✅ Logging **{nick}**'s matches to <#{interaction.channel_id}>.", ephemeral=True
|
||||
)
|
||||
|
||||
# ── /set-player ────────────────────────────────────────────────────────
|
||||
@app_commands.command(name="set-player", description="Link your Discord account to a War Thunder player")
|
||||
@app_commands.describe(player="Player username")
|
||||
@@ -290,7 +313,8 @@ class TssCommands(commands.Cog):
|
||||
name="Autologging — Manage Server",
|
||||
value=(
|
||||
"`/set-team <team>` — set this server's team\n"
|
||||
"`/log-team <team>` — post a team's matches to this channel"
|
||||
"`/log-team <team>` — post a team's matches to this channel\n"
|
||||
"`/log-player <player>` — post a player's matches to this channel"
|
||||
),
|
||||
inline=False,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user