Documentation Index
Fetch the complete documentation index at: https://mintlify.com/VasquezRivero92/Discord_Faceit/llms.txt
Use this file to discover all available pages before exploring further.
/leaderboard pulls the current season ranking from your configured Faceit Hub or Club and renders the top 10 players as a Discord embed. Linked members are shown as @mentions so the leaderboard feels native to Discord rather than just a list of Faceit nicknames. Players who have not run /verificar_fc appear with the label *(Sin vincular)*.
Syntax
Feature Flag
Guarded by thecommand_leaderboard feature flag scoped to the guild. When disabled, the bot returns an ephemeral ❌ Este comando está desactivado por el administrador. without making any API calls.
Configuration Requirements
The command readsconfig.faceitLeaderboardId first, then falls back to config.faceitHubId (loaded via getEffectiveConfigForGuild(guildId)). At least one of the following environment variables must be configured:
FACEIT_LEADERBOARD_ID— the direct ID of a season leaderboard.FACEIT_HUB_ID— the Hub ID; the bot’sfetchLeaderboard()function auto-discovers the latest active season leaderboard for that hub.
ID_, the command fails with ❌ El administrador no ha configurado el ID de Leaderboard o Hub de Faceit.
Behavior
- Feature flag check — early exit if disabled.
- Config resolution — calls
getEffectiveConfigForGuild(guildId)to get the leaderboard or hub ID. - API call — calls
fetchLeaderboard(leaderboardId). If a direct leaderboard ID returns a 404,fetchLeaderboardautomatically falls back to the hub leaderboard endpoint (/leaderboards/hubs/<id>), finds allhub_seasonentries, sorts them by season descending, and re-fetches the latest one. - Discord name resolution — calls
db.getNicknameToDiscordMap(guildId)which returns a map oflowercased Faceit nickname → Discord user IDfor all verified members in the guild. - Ranking lines — the top 10 entries from
leaderboardData.items.slice(0, 10)are formatted. Each line is built as:Medal emojis are used for positions 1–3 (🥇🥈🥉); positions 4–10 display their numeric rank followed by a period (e.g.4.).
Embed Structure
| Field | Value |
|---|---|
| Title | 🏆 Leaderboard del Club — Season <n> |
| Description | Ranked lines for up to 10 players |
| Color | Gold (0xFFD700) |
| Footer | Sincronizado con Faceit API |
leaderboardData.leaderboard.season. If that field is absent, the title falls back to Season Actual.
Response
The embed is sent as a public reply (ephemeral: false). The deferred reply is resolved with interaction.editReply({ embeds: [embed] }).
Players who have not run
/verificar_fc are shown as *(Sin vincular)* — their Faceit nickname and level are still displayed, but there is no Discord mention. Encourage all hub members to verify so the leaderboard shows full mentions.Error Reference
| Condition | Error message |
|---|---|
command_leaderboard flag is false | ❌ Este comando está desactivado por el administrador. (ephemeral) |
| Leaderboard/Hub ID not configured | ❌ El administrador no ha configurado el ID de Leaderboard o Hub de Faceit. |
| API returns no data | ⚠️ No se encontraron datos para el leaderboard de Faceit actual en este Hub/Club. |
| Unexpected API error | ❌ Ocurrió un error al obtener el leaderboard del Club. |