Configuration
It is not necessary to modify the config file after you have completed the setup of your bot. But doing so is also acceptable! The file reciple.mjs in your bot’s root directory contains the current Reciple configuration.
Reciple Config
Reciple configuration allows you to change some of Reciple’s behavior and expand its functionality.
Token
Your bot token is not directly stored in your configuration to prevent it from being leaked when using git.
export const config = {
token: process.env.TOKEN ?? ''
}; By default, Reciple will create your Discord bot and use the TOKEN environment variable to find your Discord bot token.
Commands
You can also disable specific command types and their related features such as cooldowns. Command configuration also allows you to specify which guild the application commands should be registered to.
Application Commands
The application commands are the context menus and slash commands.
export const config = {
commands: {
contextMenuCommand: {
enabled: true,
enableCooldown: true,
acceptRepliedInteractions: false,
registerCommands: {
registerGlobally: true,
registerToGuilds: []
}
},
slashCommand: {
enabled: true,
enableCooldown: true,
acceptRepliedInteractions: false,
registerCommands: {
registerGlobally: true,
registerToGuilds: []
}
}
}; acceptRepliedInteractionsPrevents replied or deffered interaction commands from executing in order to avoid errors with previously replied commands.registerCommandsAllows you to specify where these commands are registered.registerGloballyWhether to register your commands globally.registerToGuildsAn array of server ID where these commands should be registered.
Message Commands
Message commands are executed using prefixed messages. These are commonly referred to as “traditional commands”.
export const config = {
commands: {
messageCommand: {
enabled: true,
enableCooldown: true,
commandArgumentSeparator: ' ',
prefix: '!'
}
}
}; commandArgumentSeparatorThe character that separates the arguments of the commands.prefixThe character that is used at the start of a message to indicate a message command.
Example Usage of Message Command
Application Command Register
Just like the context menu and slash commands’ config, you can also configure both with applicationCommandRegister.
export const config = {
applicationCommandRegister: {
enabled: true,
allowRegisterGlobally: true,
allowRegisterToGuilds: true,
registerEmptyCommands: true,
registerToGuilds: []
}
}; allowRegisterGloballyAllows your application commands to be registered globally. This config will overwrite all application commands’ config if set tofalse.allowRegisterToGuildsAllows your application commands to be registered to guilds. This config will overwrite all application commands’ config if set tofalse.registerEmptyCommandsWhether your application should register commands when empty.registerToGuildsAn array of server ID where application commands should be registered. This will not overwrite the existing command config.
Client
This configuration allows you to modify the Discord.js Client options, which include intents, cache options, and more.
export const config = {
client: {
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMembers,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.MessageContent,
]
}
}; View
ClientOptionsDocs
Logger
This config allows you to configure the Logger.
export const config = {
logger: {
enabled: true,
debugmode: null,
coloredMessages: true,
disableLogPrefix: false,
logToFile: {
enabled: true,
logsFolder: './logs',
file: 'latest.log'
}
}
}; debugmodeShows some debug messages to the console.coloredMessagesPrints console messages with colors.disableLogPrefixDisables the time and context prefix of a log message.logToFileConfig for the log files.logsFolderThe folder where log files are saved.fileThe name of the latest log file.
Modules
This configuration allows you to change the directory where modules are stored and the files that should be excluded.
export const config = {
modules: {
dirs: ['./modules', './modules/*', './modules/*/*'],
exclude: ['halts', 'preconditions', '_*'],
filter: file => true,
disableModuleVersionCheck: false
}
}; dirsAn array of directory names that contains the module files. This config also accepts glob patterns.excludeAn array of file or dir names to exclude from loaded modules. This also accepts wildcard patterns.filterA function that returns a boolean. This functions filters the module files to be loaded.disableModuleVersionCheckWhether to check if the module supports the current version of Reciple.
Preconditions
Preconditions are functions that are executed before a command execution, and it determine whether the execution must continue. Built-in preconditions includes the CooldownPrecondition and CommandPremissionsPermissions.
export const config = {
preconditions: [
new CooldownPrecondition(),
new CommandPermissionsPrecondition()
]
}; Create your own preconditions by following the precondition schema View Docs
Command Halts
Command halts are functions that are executed after the command is terminated. This allows you to handle command errors, cooldowns, and precondition triggers. This config sets the global command halts for every commands.
export const config = {
commandHalts: []
}; Create your own command halt by following the command halt schema View Docs
Cooldown Sweeper Options
This config allows you to modify the cooldown sweeping options.
export const config = {
cooldownSweeperOptions: {
timer: 1000 * 60 * 60
}
}; timerThe interval when to sweep unused cooldowns.filterThe cooldown sweep filter function that returns a boolean when a cooldown is unused.maxAgeMsThe max age of a cooldown to be marked unused.
Check For Updates
By default, Reciple checks for updates when Reciple process is started.
export const config = {
checkForUpdates: true
}; version
export const config = {
version: '^9.x.x'
};