Documentation menu

Client Configuration

Citadel Bot reads two bot-wide config sources: config/config.js (settings) and config/.env (secrets and runtime flags). Per-server settings live separately in config/servers.js.

config/config.js

Copy config.example.js to config.js and edit:

const { PermissionsBitField } = require('discord.js');

module.exports = {
  // Bot presence
  presence: {
    status: 'online',                       // online | idle | dnd | invisible
    activities: [ { name: '/help', type: 'Listening' } ] // Playing | Streaming | Listening | Watching
  },

  // Who has elevated permission levels (see Permissions)
  permissions: {
    moderatorRoleIds:     [ 'roleId', ... ], // → Moderator (level 1)
    administratorRoleIds: [ 'roleId', ... ], // → Administrator (level 2)
    ownerId:  'yourDiscordUserId',           // → Bot Owner (level 5)
    developers: [ 'userId', ... ]            // → Developer (level 4)
  },

  // Permissions added when generating the /invite link
  permissionsBase: [
    PermissionsBitField.Flags.ViewChannel,
    PermissionsBitField.Flags.SendMessages,
    PermissionsBitField.Flags.SendMessagesInThreads
  ],

  // Where /support points
  supportServerInviteLink: 'https://discord.gg/UnJajmfuKs'
};

See Permissions for how the role/ID lists map to permission levels.

Environment variables

Required

VariableWhat
DISCORD_BOT_TOKENThe bot token
CLIENT_IDThe application (client) id
CFTOOLS_API_APPLICATION_IDCFTools application id (hex)
CFTOOLS_API_SECRETCFTools application secret

Slash command registration

VariableDefaultWhat
REFRESH_SLASH_COMMAND_API_DATAtrueRegister/refresh commands on boot
CLEAR_SLASH_COMMAND_API_DATAfalseClear all command data on boot
TEST_SERVER_GUILD_IDIf set, register commands instantly in this one guild (otherwise global, up to ~1h to propagate)

Operational

VariableDefaultWhat
NODE_ENVproductionSet production for deployment
USE_APIfalseEnable the optional HTTP API
PORT3000Port for the HTTP API

Debug

VariableDefaultWhat
DEBUG_ENABLEDfalseVerbose debug logging
DEBUG_INTERACTIONSfalseDump each interaction object to the console
DEBUG_SLASH_COMMAND_API_DATAtrueLog command data on refresh
DEBUG_AUTOCOMPLETE_RESPONSE_TIMEtrueLog autocomplete timings
DEBUG_COMMAND_THROTTLINGfalseLog cooldown throttling

Coolify / env-only deploys

When generating config from the environment (see Installation → Coolify), these additional vars feed the generator:

VariableMaps to
OWNER_IDpermissions.ownerId
MODERATOR_ROLE_IDS / ADMINISTRATOR_ROLE_IDScomma-separated role lists
DEVELOPER_IDSpermissions.developers
SUPPORT_SERVER_INVITEsupportServerInviteLink
SERVER_NAME, CFTOOLS_SERVER_API_ID, SERVER_IPV4, SERVER_PORTthe generated server entry
CITADEL_RELAY_ENABLED, CITADEL_API_URL, CITADEL_SERVICE_ID, CITADEL_API_KEYrelay settings

Next: Server Configuration.