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.
/crear_sala orchestrates a complete manual match setup entirely within Discord — no Faceit room is created. It scoops 10 players out of a voice channel, runs an exhaustive combinatorial ELO-balance algorithm across all C(10,5) = 252 possible team splits, creates two private temporary voice channels named 🔊 Equipo A (Manual) and 🔊 Equipo B (Manual), moves each player to their assigned channel, posts a match-announcement embed with result buttons, and records the match in Firestore. When a match announcement message is successfully posted, each participant also receives a DM with their team assignment.
Syntax
Parameters
The source voice channel from which to pull the 10 players. If omitted, the bot tries the command caller’s current voice channel first, then falls back to the configured
DISCORD_WAITING_ROOM_CHANNEL_ID. Must be a GuildVoice channel — stage channels are not accepted.Required Permissions
- The caller must be in a voice channel or must specify
canal_vozexplicitly. - The bot requires
MoveMembers(andManageChannels/Connect/Speak) in the target category to create and move players into the temporary channels.
You need at least 10 players present in the source voice channel when the command is executed. If fewer than 10 are found, the bot returns an error with the current count and takes no further action.
Behavior
1 — Source Channel Resolution
The bot checks, in order:canal_vozoption (if provided).- The caller’s current voice channel (
interaction.member.voice.channel). config.discordWaitingRoomChannelIdfetched from guild config.
GuildVoice channel, the command fails.
2 — Player Data Collection
For every member in the source channel, the bot callsdb.getFullUser(memberId, guildId). Linked players contribute their actual faceit_elo and faceit_level; unlinked players receive default values of ELO 1000 / Level 3. Linked players are prioritised: the list is sorted [...linkedPlayers, ...unlinkedPlayers] before the first 10 are selected.
3 — ELO Balancing Algorithm
Math.abs(eloA - eloB), and returns { teamA, teamB, diff }.
4 — Private Voice Channel Creation
Two channels are created viaguild.channels.create() with ChannelType.GuildVoice in the same category as the source channel:
| Channel | Name |
|---|---|
| Team A | 🔊 Equipo A (Manual) |
| Team B | 🔊 Equipo B (Manual) |
Connect to @everyone. The bot grants itself ViewChannel, Connect, Speak, ManageChannels, and MoveMembers. Each assigned player is granted Connect and Speak for their respective channel only — making both channels effectively private.
5 — Player Movement
All 10 players are moved (member.voice.setChannel()) to their assigned voice channels. Original voice states are saved in originalVoiceStates so players can be returned when the match ends.
6 — Announcement Embed & Buttons
A match-announcement embed is posted toDISCORD_MATCHES_CHANNEL_ID:
- Lists both rosters with Discord mentions, Faceit nicknames, and levels.
-
Includes three action buttons:
Button Custom ID pattern Style 🏆 Ganó Equipo A manual_match_win_a_<matchId>Success (green) 🏆 Ganó Equipo B manual_match_win_b_<matchId>Success (green) ❌ Cancelar manual_match_cancel_<matchId>Danger (red)
7 — Player DMs
If the announcement message was posted successfully, each of the 10 players receives a DM embed confirming:- Which team they are on (Equipo A or Equipo B).
- A voice channel mention for their private channel.
- A link to the announcement message in the matches channel.
DISCORD_MATCHES_CHANNEL_ID is not configured or the announcement message could not be sent.
8 — Firestore Record
The match is saved viadb.addActiveMatch(matchId, matchData, vc1.id, vc2.id, messageId, rosterA, rosterB, originalVoiceStates, guildId) and is immediately visible in /partidas.
A unique matchId is generated as manual_<timestamp>_<6-char-random>.
Response
The caller receives an ephemeral confirmation (deferReply({ ephemeral: true })):
Error Reference
| Condition | Error message |
|---|---|
| No valid source voice channel found | ❌ No se encontró ningún canal de voz de origen. |
| Fewer than 10 players in the channel | ❌ Se necesitan al menos 10 jugadores en el canal de voz **X** (actualmente hay N). |
| Unexpected error | ❌ Ocurrió un error al intentar crear la sala. |