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.
Every significant behavior in the Discord Faceit Hub Bot is gated behind a feature flag. This lets you turn off individual features — like voice channel automation or a specific slash command — without redeploying the bot or touching code. Flags are stored in Firestore and checked at runtime with a 30-second memory cache.
How Feature Flags Work
Feature flag state is stored in the faceit_config → settings Firestore document. The featureFlags.js utility reads this document and caches the result in memory:
const CACHE_TTL_MS = 30 * 1000; // 30 seconds
The primary function for checking flags is isFeatureEnabled(featureKey, guildId):
export async function isFeatureEnabled(featureKey, guildId = null) {
// 1. If a guildId is provided, check guild-specific settings first
if (guildId) {
const guildSettings = await db.getGuildSettings(guildId);
if (guildSettings && guildSettings[featureKey] !== undefined) {
return guildSettings[featureKey] === true;
}
}
// 2. Fall back to global settings
const settings = await getSettings();
if (featureKey.startsWith('command_') && settings[featureKey] === undefined) {
return true; // commands default to enabled if not explicitly set
}
return settings[featureKey] === true;
}
If a guild has a per-guild setting for a flag (via db.getGuildSettings(guildId)), it takes precedence over the global settings document. This means you can disable a feature for one server without affecting others. Guild-scoped settings are written by the admin panel when you toggle a flag with a specific guild selected.
Default Settings
The getDefaultSettings() function defines what the bot uses when no Firestore document exists yet:
export function getDefaultSettings() {
return {
autoWelcomeDm: true,
autoRoleSync: true,
autoVoiceChannels: true,
autoMovePlayers: true,
matchAnnouncements: true,
serverStatusAnnouncements: true,
liveMatchPanel: true,
webhookValidation: false,
adminCallNotifications: true,
adminRoleName: 'ADMIN',
matchTimeoutMinutes: 120,
command_mixton_listo: true,
command_mixton_no_listo: true,
};
}
Note that webhookValidation defaults to false — signature validation is opt-in to simplify initial setup.
Flag Reference
Automation Flags
| Key | Default | Description |
|---|
autoWelcomeDm | true | Send a welcome DM embed to new members who link their Faceit account |
autoRoleSync | true | Sync Faceit level and club roles automatically on link and after match finish |
autoVoiceChannels | true | Create temporary voice channels for each team when a match starts |
autoMovePlayers | true | Auto-move verified players to their match voice channel on match start |
matchAnnouncements | true | Post match status embeds (configuring / started / finished / cancelled) to the matches channel |
serverStatusAnnouncements | true | Post a LATAM server status embed to the status channel on match start |
liveMatchPanel | true | Maintain a pinned live match panel embed in the matches channel, updated on every match event |
Security Flag
| Key | Default | Description |
|---|
webhookValidation | false | Validate the x-faceit-signature / x-webhook-signature header on incoming Faceit webhooks against FACEIT_WEBHOOK_SECRET |
Leave webhookValidation set to false during initial setup and testing. Once your FACEIT_WEBHOOK_SECRET env var is set and you have confirmed that real Faceit webhooks are arriving correctly, enable this flag in the admin panel to reject any unsigned or spoofed webhook payloads.
Notification Flag
| Key | Default | Description |
|---|
adminCallNotifications | true | Enable support call alerts — pings the admin alerts channel when a player requests support |
Command Flags
Each slash command can be individually disabled. When a command flag is false, the bot returns a 403 response to that interaction.
| Key | Default | Discord Command |
|---|
command_verificar | true | /verificar_fc — link Discord to Faceit account |
command_stats | true | /stats — show player stats by Faceit nickname |
command_leaderboard | true | /leaderboard — show hub season leaderboard |
command_sincronizar | true | /sincronizar_fc — manually re-sync roles |
command_desvincular | true | /desvincular_fc — unlink account |
command_partidas | true | /partidas — show active matches |
command_info | true | /info — show bot/hub information |
command_mixton_listo | true | /mixton_listo — register as ready for a Mixton draft |
command_mixton_no_listo | true | /mixton_no_listo — remove yourself from the Mixton draft queue |
Toggling Flags
Via Admin Panel
- Navigate to
https://your-domain/admin
- Open the Features tab
- Click any toggle to immediately enable or disable that flag
The panel calls POST /api/admin/features/:key?guildId=<id> with body { "enabled": true } or { "enabled": false }. The change is written to Firestore and the in-memory cache invalidates automatically within 30 seconds.
Via API
curl -X POST https://your-domain/api/admin/features/autoVoiceChannels \
-H "Content-Type: application/json" \
-H "Cookie: admin_token=<your-jwt>" \
-d '{ "enabled": false }'
Include ?guildId=<guild-id> to scope the change to a specific guild.
Via Firestore Directly
Open the Firestore console, navigate to faceit_config → settings, and set any flag key to true or false. The change propagates to the bot within 30 seconds (next cache expiry). For per-guild overrides, find the guild’s settings document in guild_settings/<guildId> and set the key there.
Cache Invalidation
The settings cache can be invalidated immediately without waiting for the TTL by calling invalidateSettingsCache():
export function invalidateSettingsCache() {
cachedSettings = null;
lastFetch = 0;
}
This is called automatically by the admin API routes after any flag toggle, ensuring the bot picks up changes on the very next feature check.