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.

Follow these steps to go from a fresh machine to a fully operational bot. The whole process takes under 10 minutes if you already have a Firebase project and a Discord application ready.
1

Clone and install

Clone the repository and install dependencies with npm.
git clone https://github.com/VasquezRivero92/Discord_Faceit.git && cd Discord_Faceit && npm install
Node.js 18 or later is required. The project is written with "type": "module" in package.json, which means it uses native ES Modules and top-level await — CommonJS require() will not work.
2

Create a Discord Application

  1. Go to discord.com/developers/applications and click New Application.
  2. Navigate to the Bot tab and enable the following Privileged Gateway Intents:
    • Server Members Intent (GuildMembers)
    • Message Content Intent is not required, but ensure Guilds, Guild Messages, Guild Members, and Guild Voice States are all active in your bot code.
  3. Click Reset Token to reveal your bot token. Copy it — this is your DISCORD_TOKEN.
  4. Copy the Application ID from the General Information page — this is your DISCORD_CLIENT_ID.
  5. Under OAuth2 → General, add a redirect URL:
    https://YOUR_DOMAIN/auth/discord/callback
    
  6. Copy the Client Secret shown on the same page — this is your DISCORD_CLIENT_SECRET.
3

Set up Firebase

  1. Create a new project at console.firebase.google.com.
  2. In the project, go to Build → Firestore Database and click Create database. Select Native mode and choose a region close to your server.
  3. Go to Project Settings → Service Accounts → Generate New Private Key. A JSON file will download.
  4. Save the JSON file inside your project directory (e.g. ./firebase-credentials.json) and set the path in FIREBASE_SERVICE_ACCOUNT_PATH.
If FIREBASE_SERVICE_ACCOUNT_PATH is omitted, the bot falls back to Application Default Credentials. This works on Google Cloud Run and App Engine without any key file.
4

Get a Faceit API Key

  1. Visit developers.faceit.com and log in.
  2. Create a new application and select Server-Side as the API key type.
  3. Copy the generated key — this is your FACEIT_API_KEY.
  4. Open your Hub in the Faceit dashboard. The Hub UUID is visible in the URL (/hubs/{uuid}). Copy it — this is your FACEIT_HUB_ID.
5

Configure environment variables

Create a .env file in the project root with the following keys. Only DISCORD_TOKEN and DISCORD_CLIENT_ID are strictly required to boot; all other variables enable specific features.
.env
# Discord
DISCORD_TOKEN=
DISCORD_CLIENT_ID=
DISCORD_CLIENT_SECRET=
DISCORD_GUILD_ID=

# Admin panel
ADMIN_JWT_SECRET=

# Firebase
FIREBASE_SERVICE_ACCOUNT_PATH=./firebase-credentials.json

# Faceit
FACEIT_API_KEY=
FACEIT_HUB_ID=
FACEIT_LEADERBOARD_ID=
FACEIT_WEBHOOK_SECRET=

# Server
PORT=3000
BASE_URL=https://your-domain.com

# Discord channels (optional — each unlocks specific features)
DISCORD_LINK_CHANNEL_ID=
DISCORD_MATCHES_CHANNEL_ID=
DISCORD_ROLES_CHANNEL_ID=
DISCORD_STATUS_CHANNEL_ID=
DISCORD_ADMIN_ALERTS_CHANNEL_ID=
DISCORD_WAITING_ROOM_CHANNEL_ID=
DISCORD_SUPPORT_CHANNEL_ID=

# Roles
ADMIN_ROLE_NAME=ADMIN
See the Configuration reference for a full description of every variable.
6

Start the bot

npm start
On startup the bot performs the following automatically:
  1. Validates configuration — throws an error immediately if DISCORD_TOKEN or DISCORD_CLIENT_ID is missing.
  2. Loads slash commands — dynamically imports all command files from the commands/ directory.
  3. Registers commands — pushes slash commands globally to the Discord API via client.once('ready').
  4. Cleans up orphan voice channels — removes any match voice channels from a previous run that were not properly deleted.
  5. Initialises the live match panel — posts or updates the live matches embed in DISCORD_MATCHES_CHANNEL_ID.
The Express server starts listening on PORT (default 3000) at the same time. A health check endpoint is available at GET /health.
7

Invite the bot to your server

  1. Go to your application in the Discord Developer Portal → OAuth2 → URL Generator.
  2. Select the following Scopes: bot, applications.commands.
  3. Select the following Bot Permissions:
    • Manage Roles
    • Manage Channels
    • Move Members
    • Send Messages
    • Embed Links
    • Read Message History
  4. Copy the generated URL, open it in your browser, and select your server.
8

Configure Faceit webhook

  1. Open your Faceit Hub dashboard and navigate to Settings → Webhooks.
  2. Add a new webhook with the URL:
    https://YOUR_DOMAIN/webhook/faceit
    
  3. Enable the following events:
    EventTrigger
    match_status_configuringMatch room is being set up
    match_status_startingMatch has started (map confirmed)
    match_status_finishedMatch completed with a result
    match_status_cancelledMatch was cancelled or aborted
    hub_user_role_addedA player was assigned a Club role
    hub_user_role_removedA Club role was removed from a player
  4. If you set FACEIT_WEBHOOK_SECRET, copy the same value into the webhook secret field in Faceit so signature validation is enforced.
After starting, players can immediately run /verificar_fc <nickname> to link their Faceit account and receive level roles. The link command is restricted to DISCORD_LINK_CHANNEL_ID if that variable is set.

Build docs developers (and LLMs) love