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.

A Mixton is a community-organised custom match that happens outside of the Faceit matchmaking queue. Staff set up a lobby on the web panel, assign captains, and captains take turns picking from a pool of available players sorted by ELO tier. The moment any state changes — a player joins the queue, a captain is assigned, a pick is made — the web panel updates in real time via WebSocket. All routes live in routes/lobby.js; the Discord side is powered by the /mixton_listo and /mixton_no_listo commands.

Player Queue — Discord Commands

/mixton_listo

Marks the player as available for the next Mixton. Only works for verified (linked) users — unverified players see an error pointing them to /verificar_fc. Sets mixton_ready = true in Firestore via db.setPlayerReadyStatus() and emits a mixtonEvents.emit('update', guildId) event to trigger a WebSocket broadcast.

/mixton_no_listo

Removes the player from the ready queue. Sets mixton_ready = false via db.setPlayerReadyStatus() and broadcasts the updated state. Also requires a verified account.
Both commands are guarded by the command_mixton_listo and command_mixton_no_listo feature flags respectively. They can be toggled from the admin panel or via POST /api/lobby/mixton-toggle-command.

ELO Tiers

Players in the ready queue are automatically sorted into four tiers based on their faceit_level stored in Firestore:
TierFaceit LevelsNotes
S10Highest tier; eligible for captain assignment
A8, 9High tier; eligible for captain assignment
B5, 6, 7Mid tier
C1, 2, 3, 4Entry tier
Within each tier, players are sorted by faceit_elo descending. An admin can override any player’s tier via POST /api/lobby/mixton-override-tier, supplying { playerDiscordId, tier } where tier is "S", "A", "B", "C", or null (resets to automatic). The override is stored as mixton_tier_override on the user’s Firestore document.
Captains can only be assigned from Tier S or Tier A players. The POST /api/lobby/mixton-assign-captain endpoint enforces this check and returns a 400 error if a lower-tier player is nominated.

Full Draft Flow

1

Configure teams — POST /api/lobby/mixton-setup

An admin sends { numTeams } (between 2 and 6). The endpoint resets the lobby state: each team gets an ID (team_1, team_2, …), an empty captain slot, and an empty player array. The pickOrder, currentPickIndex, draftStarted, and draftFinished fields are all reset.
2

Assign captains — POST /api/lobby/mixton-assign-captain

Send { teamId, discordId } for each team. The bot validates that the player is Tier S or A, resolves their Discord display details, and saves them as the team captain. A DM is sent to the captain with a link to the web panel and instructions to log in and start picking. The pickOrder array is automatically rebuilt from teams that have a captain.
3

Set pick order — POST /api/lobby/mixton-pick-order

Send { pickOrder: ["team_1", "team_2", ...] } to define the snake-draft or any custom order. All teams in the array must already have captains.
4

Start draft — POST /api/lobby/mixton-start

Validates that every team has a captain. Sets draftStarted = true, draftFinished = false, currentPickIndex = 0, and clears any previously picked players. From this point the web panel shows each team’s empty roster slots.
5

Captains pick — POST /api/lobby/mixton-pick

Send { playerDiscordId }. The endpoint checks that:
  • The draft is active and not finished.
  • The caller is the captain of the current-turn team (or an admin).
  • The player is in the ready queue (mixton_ready === true) and not already assigned.
The player is added to the current team’s players array, and currentPickIndex advances to the next team in pickOrder (cycling round-robin until all slots are filled).
6

Create match — POST /api/lobby/mixton-create-match

Once all picks are complete (draftFinished is set to true automatically by the last mixton-pick call), an admin sends { teamIdA, teamIdB } to launch the actual match. The endpoint creates 🔊 Equipo N (Web) voice channels for each team (placed in the same category as the waiting room), moves players who are already in voice, posts a match announcement embed with Win A / Win B / Cancel buttons in DISCORD_MATCHES_CHANNEL_ID, and sends a DM to every participant with their team assignment and a link to the announcement.

Real-Time WebSocket Updates

A WebSocket server listens at /api/lobby/mixton-ws. When a client connects it receives the full current lobby state immediately:
{
  "type": "state_update",
  "data": {
    "state": { "teams": [...], "draftStarted": false, ... },
    "availablePlayers": { "S": [...], "A": [...], "B": [...], "C": [...] },
    "commandEnabled": true,
    "guildName": "My CS2 Community",
    "guildId": "123456789"
  }
}
Every mutation — a /mixton_listo command, a captain assignment, a pick, or an admin action — calls mixtonEvents.emit('update', guildId) in routes/lobby.js, which triggers broadcastLobbyState() and pushes the updated payload to every connected client whose guildId matches.

Manual Match from the Web — POST /api/lobby/create-match

Admins can skip the draft entirely and launch a 5v5 directly by supplying two arrays of exactly five Discord IDs ({ teamA, teamB }). The endpoint:
  1. Validates all players are verified in Firestore for the correct guild.
  2. Creates 🔊 Equipo A (Web) and 🔊 Equipo B (Web) voice channels.
  3. Moves players who are already in voice to their team channel.
  4. Posts a match announcement embed in DISCORD_MATCHES_CHANNEL_ID with Win A / Win B / Cancel buttons.
  5. Sends a DM to each player with their team assignment and a link to the announcement.
  6. Saves the match to the active matches Firestore collection and updates the live panel.

Admin Utility Endpoints

EndpointAction
POST /api/lobby/mixton-override-tierOverride a player’s tier (S/A/B/C/null)
POST /api/lobby/mixton-assign-playerDirectly assign a player to a team (bypasses turn order)
POST /api/lobby/mixton-remove-playerRemove a player from a team’s roster
POST /api/lobby/mixton-clear-teamEmpty an entire team (captain + all players)
POST /api/lobby/mixton-reset-playersMark all ready players as not ready
POST /api/lobby/mixton-resetFull lobby reset

Alternative: /crear_sala — ELO-Balanced Room from Voice

For a quicker alternative without a web panel, any user can run /crear_sala directly in Discord. The command reads 10 players from a target voice channel (optionally specified; defaults to the caller’s channel or the waiting room) and divides them into two perfectly balanced teams using a combinatorial ELO algorithm:
  • All C(10, 5) = 252 possible 5v5 splits are evaluated.
  • The split with the lowest absolute ELO difference between both teams is selected.
  • Two private voice channels (🔊 Equipo A (Manual) and 🔊 Equipo B (Manual)) are created and players are moved in immediately.
Verified players contribute their actual stored faceit_elo; unverified players are assigned a default ELO of 1000 and a default level of 3.
For full draft capabilities — captain-driven picks, tier pools, match history, and team management — use the Mixton Arena web panel. /crear_sala is best for casual quick rooms where you want instant ELO balancing without any setup.

Build docs developers (and LLMs) love