DiscordFeaturesHandlerOptions
The properties to configure DiscordFeaturesHandler how you want it and to get your discord.js bot up and running.
Here is a sample usage with the all properties and parameters.
DiscordFeaturesHandler(client, {
config = "./config.js", // if using TS, remove the extension: "./config"
directories = {
main: __dirname
commands: "commands",
events: "events",
modules: "modules",
},
builtin_files = {
disable_all: false,
commands: {
help: false,
reload: false,
},
events: {
messageCreate: false,
interactionCreate: false,
},
},
onLoad_list_files = {
commands: false,
events: false,
modules: false,
},
disableUnhandledRejectionHandler = false,
modulesPreloadTime = 500,
filesToExcludeInHandlers = {
commands: [""],
events: [""],
modules: [""],
},
});
Properties
The DiscordFeaturesHandlerOptions object contains properties to configure DiscordFeaturesHandler how you want it and to get your discord.js bot up and running.
config string
The path and filename to your config file. If empty, it will use a default config file. Please refer to config file to see the setup and customization.
directories object
The object containing the folder names and main directory path. The main property is required.
Properties | Type | Required | Description |
---|---|---|---|
main | string | true |
The full path location to the script file Expected value: __dirname |
commands | string | false | Folder name that contains your command files. Default: "commands" |
events | string | false | Folder name that contains your event files. Default: "events" |
modules | string | false | Folder name that contains your modules files. Default: "modules" |
builtin_files object
This object contains properties of true or false values of what built-in commands and events to disable.
Properties | Type | Default | Description |
---|---|---|---|
disable_all | boolean | false | Disables all built-in commands and events |
commands | Object | { ... } | Object contains the name of all built-in commands, that you may want to disable. Commands: help and reload |
events | Object | { ... } | Object contains names of all built-in events that you may want to disable. Events: messageCreate, interactionCreate |
onLoad_list_files object
This object contains properties of true or false values of what built-in commands and events to disable.
Properties | Type | Default | Description |
---|---|---|---|
commands | boolean | false | Enable console log of command files being loaded |
events | boolean | false | Enable console log of event files being loaded |
modules | Object | false | Enable console log of module files being loaded |
disableUnhandledRejectionHandler Boolean
A Boolean to disable the pre-defined unhandledRejection function to handle uncaught promise rejections, where the bot would not crash upon reaching the rejection.
Info
Recommend disabling only to use if you are re-creating this handler to print out the error tailored to read. Otherwise your bot may crash more often.
modulesPreloadTime Number
The time to wait before loading module files. This is used to establish a waiting time to connect to the Discord API and ensure we can access the guilds the bot has access to and their Discord Channels, users, and guild information to use within the module files that are waiting to be loaded. The time value is in milliseconds, and by default, the wait time is 500 ms or half a second before the module files are loaded. You can update the time if you require a longer wait time for other API-related tasks such as connecting to a database.
filesToExcludeInHandlers Object
An object that contains properties of handler names for the array of strings. The strings represent files that should not run when the bot starts up.
Properties
Property | Type | Description |
---|---|---|
commands | Array<string> |
The command files that should not run when the handler is invoked |
events | Array<string> |
The event files that should not run when the handler is invoked |
modules | Array<string> |
The module files that should not run when the handler is invoked |