Skip to content
Docs
CFTools Discord Bot
Configuration

Configuration

This page explains how to create your configuration files, what the indivudual files represent, and what the configuration values mean. All configuration is done in the /config folder, don't move files out of this folder.

🚫
It is important that you leave the .example files intact. They are used to point out the differences in configuration when you update to later versions. Aside form that, renaming the .example files directly will also create merge issues when updating to later versions

The .env file

First off, we'll have to create our own local config/.env file.

🚫
Never share this file or it's contents with anyone

This is an environmental file, meaning it is excluded from our Git/GitHub repository. This file contains environmental specific values, and sensitive credentials.

💡
Windows users often experience issues with this file, if you're getting errors that the env file can't be found, Provide a valid file extension errors when renaming, or Expected path argument to be of type string errors when starting the application - check out this timestamped video (opens in a new tab)
  1. Navigate into the /config folder
  2. Copy & Paste .env.example and rename the newly created file to .env
  3. Fill in your environmental values

Required environmental values

Configuration OptionDescriptionValue
Required Variables
NODE_ENVThe Node environment, only change if you know what you're doingproduction or development
DISCORD_BOT_TOKENThe token used to login to your Discord Bot User, refer to the guidestring(secret)
CLIENT_IDThe user-id of your Discord bot user, refer to the guidestring
CFTools
CFTOOLS_API_APPLICATION_IDThe id used to identify your application on the CFTools Data API, refer to the guidestring
CFTOOLS_API_SECRETThe secret that represents a password for your application on the CFTools Data API, refer to the guidestring(secret)

Optional environmental values

💡
All of these are strictly optional and the default values will work best for most users. Feel free to skip this section
🚫
If you're on MacOS, you want to manually point your PATH_TO_CHROME_EXECUTABLE, and remove google-chrome-stable from your Dockerfile (if applicable)
Configuration OptionDescriptionType
PATH_TO_CHROME_EXECUTABLEThe absolute path to your Chromium binary executable, uses puppeteer-core (opens in a new tab) if providedstring
Debug Variables
DEBUG_ENABLEDPerform extensive debug logging when enabledboolean
DEBUG_SLASH_COMMAND_API_DATAAnalyze command data that get's send to the Discord APIboolean
DEBUG_INTERACTIONSDebug log incoming interactions (buttons, slash-commands, modals, etc)boolean
DEBUG_AUTOCOMPLETE_RESPONSE_TIMEPrint how long it takes to perform auto-complete handler queriesboolean
DEBUG_MODAL_SUBMIT_RESPONSE_TIMEPrint how long it takes to acknowledge a modal-interactionboolean
DEBUG_COMMAND_THROTTLINGPerform extensive debug logging on user command throttlingboolean
API Application Command Data
REFRESH_SLASH_COMMAND_API_DATAShould we register our Discord command API data when bootingstring
CLEAR_SLASH_COMMAND_API_DATAShould we clear our Discord command API data on bootstring
Internal API/Server
USE_APIIs the internal server/api enabled, used for status monitoring and exporting command databoolean
PORTIf the internal server/api is enabled, what port number should the API be hosting onnumber
Data Structure
CHAT_INPUT_COMMAND_DIRRoot path to the command directorystring
CONTEXT_MENU_COMMAND_DIRRoot path to the context-menu directorystring
AUTO_COMPLETE_INTERACTION_DIRRoot path to the auto-complete-handler directorystring
BUTTON_INTERACTION_DIRRoot path to the button-interaction directorystring
MODAL_INTERACTION_DIRRoot path to the modal-interaction directorystring
SELECT_MENU_INTERACTION_DIRRoot path to the select-menu-handler directorystring

The configuration file

Next, we'll have to create our config/config.js file.

This file contains configuration values that are neither credentials, environmental values, or server-specific options. The bot status/activity and internal permission levels are configured here.

  1. Navigate into the /config folder
  2. Copy & Paste config.example.js and rename the file to config.js
  3. Fill in your configuration values

Configuration options explained

This configuration requires you to have Discord Developer Mode enabled on your client
{
  // Bot activity
  presence: {
    // The status - one of online, idle, invisible, dnd
    status: 'online',
    activities: [
      {
        // The text displayed in the bot status
        // In the example: Listening to "/help"
        name: '/help',
        // One of Playing, Streaming, Listening, Watching
        type: 'Listening'
      }
    ]
  },
 
  // Permission config
  // Right-click channels/roles/users and select "Copy ID"
  // If you don't see this option - enable "Discord Developer Mode"
  // Discord > Settings > Advanced > Developer Mode
  permissions: {
    // Array of Moderator role ids
    moderatorRoleIds: [ '968222116682022962', '1112021605267288096' ],
    // Array of Administrator role ids
    administratorRoleIds: [ '793898367243386940' ],
    // Bot Owner, highest permission level (5)
    ownerId: '290182686365188096',
    // Bot developers, second to highest permission level (4)
    developers: [ '625286565375246366' ]
  },
 
  // Additional permissions that are considered required when generating
  // the bot invite link with /invite
  // Modify only if you're adding new commands
  // that require additional permissions
  permissionsBase: [
    PermissionsBitField.Flags.ViewChannel,
    PermissionsBitField.Flags.SendMessages,
    PermissionsBitField.Flags.SendMessagesInThreads
  ],
 
  // The Discord server invite to the bot Support server
  supportServerInviteLink: 'https://discord.gg/mirasaki'
};
🚫
This configuration is partial and a reference, do not replace your full file contents with this example, make edits to your existing file instead