Skip to main content

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

/leaderboard
This command accepts no parameters.

Feature Flag

Guarded by the command_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 reads config.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’s fetchLeaderboard() function auto-discovers the latest active season leaderboard for that hub.
If neither is set or the value still contains the placeholder prefix ID_, the command fails with ❌ El administrador no ha configurado el ID de Leaderboard o Hub de Faceit.

Behavior

  1. Feature flag check — early exit if disabled.
  2. Config resolution — calls getEffectiveConfigForGuild(guildId) to get the leaderboard or hub ID.
  3. API call — calls fetchLeaderboard(leaderboardId). If a direct leaderboard ID returns a 404, fetchLeaderboard automatically falls back to the hub leaderboard endpoint (/leaderboards/hubs/<id>), finds all hub_season entries, sorts them by season descending, and re-fetches the latest one.
  4. Discord name resolution — calls db.getNicknameToDiscordMap(guildId) which returns a map of lowercased Faceit nickname → Discord user ID for all verified members in the guild.
  5. Ranking lines — the top 10 entries from leaderboardData.items.slice(0, 10) are formatted. Each line is built as:
    🥇 @DiscordMention — NickName (Lvl 8) [320 pts]
    
    Medal emojis are used for positions 1–3 (🥇🥈🥉); positions 4–10 display their numeric rank followed by a period (e.g. 4.).

Embed Structure

FieldValue
Title🏆 Leaderboard del Club — Season <n>
DescriptionRanked lines for up to 10 players
ColorGold (0xFFD700)
FooterSincronizado con Faceit API
The season number is read from 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

ConditionError 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.
If you manage multiple Discord servers all pointing to the same Faceit Hub, each server maintains its own nicknameToDiscordMap. Players must run /verificar_fc on each server where they want their Discord mention to appear.

Build docs developers (and LLMs) love