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.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.
Clone and install
Clone the repository and install dependencies with npm.
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.Create a Discord Application
- Go to discord.com/developers/applications and click New Application.
- 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.
- Server Members Intent (
- Click Reset Token to reveal your bot token. Copy it — this is your
DISCORD_TOKEN. - Copy the Application ID from the General Information page — this is your
DISCORD_CLIENT_ID. - Under OAuth2 → General, add a redirect URL:
- Copy the Client Secret shown on the same page — this is your
DISCORD_CLIENT_SECRET.
Set up Firebase
- Create a new project at console.firebase.google.com.
- In the project, go to Build → Firestore Database and click Create database. Select Native mode and choose a region close to your server.
- Go to Project Settings → Service Accounts → Generate New Private Key. A JSON file will download.
- Save the JSON file inside your project directory (e.g.
./firebase-credentials.json) and set the path inFIREBASE_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.Get a Faceit API Key
- Visit developers.faceit.com and log in.
- Create a new application and select Server-Side as the API key type.
- Copy the generated key — this is your
FACEIT_API_KEY. - Open your Hub in the Faceit dashboard. The Hub UUID is visible in the URL (
/hubs/{uuid}). Copy it — this is yourFACEIT_HUB_ID.
Configure environment variables
Create a See the Configuration reference for a full description of every variable.
.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
Start the bot
- Validates configuration — throws an error immediately if
DISCORD_TOKENorDISCORD_CLIENT_IDis missing. - Loads slash commands — dynamically imports all command files from the
commands/directory. - Registers commands — pushes slash commands globally to the Discord API via
client.once('ready'). - Cleans up orphan voice channels — removes any match voice channels from a previous run that were not properly deleted.
- Initialises the live match panel — posts or updates the live matches embed in
DISCORD_MATCHES_CHANNEL_ID.
PORT (default 3000) at the same time. A health check endpoint is available at GET /health.Invite the bot to your server
- Go to your application in the Discord Developer Portal → OAuth2 → URL Generator.
- Select the following Scopes:
bot,applications.commands. - Select the following Bot Permissions:
- Manage Roles
- Manage Channels
- Move Members
- Send Messages
- Embed Links
- Read Message History
- Copy the generated URL, open it in your browser, and select your server.
Configure Faceit webhook
- Open your Faceit Hub dashboard and navigate to Settings → Webhooks.
-
Add a new webhook with the URL:
-
Enable the following events:
Event Trigger 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 -
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.