Komada(configopt)

The class for the magic behind Komada

new Komada(configopt)

Creates a new instance of Komada
Parameters:
Name Type Attributes Default Description
config Komada.Options <optional>
{} The configuration options to provide to Komada

Extends

  • external:Client

Members

aliases :external:Collection

The collection of aliases that point to commands in Komada

application :Object

The oauth bots application. This will either be a full application object when Komada has finally loaded or null if the bot is a selfbot.

argResolver :ArgResolver

The resolver that resolves arguments in commands into their expected results

clientBaseDir :String

The location of where you installed Komada, Can be a absolute/relative path or the path to your app/index.js

commandFinalizers :external:Collection

The collection of finalizers ran on succcesful commands.

commandInhibitors :external:Collection

The collection of inhibitors ran on commands

commandMessageLifetime :Number

The lifetime of command messages before they are removed from the cache and not editable anymore.

commandMessages :external:Collection

The collection of stored command messages

commandMessageSweep :Number

The amount of time in between each command message sweep in Komada.

commands :external:Collection

The collection of commands available for use in Komada

config :Komada.Options

The configuration used to create Komada

console :KomadaConsole

The console for this instance of Komada. You can disable timestmaps, colors, and add writable streams as config options to configure this.

coreBaseDir :String

The location of where the core files of Komada rely in, typically inside node_modules

eventHandlers :external:Collection

The collection of event handlers in Komada, used for reloading

funcs :Loader

An object containing all the functions within Komada

readonly invite

The invite link for the bot

messageMonitors :external:Collection

The collection of monitors that are ran are specific or all messages.

methods :Object

Additional methods to be used elsewhere in the bot
Properties:
Name Type Description
Collection Class A discord.js collection
Embed Class A discord.js Message Embed
MessageCollector Class A discord.js MessageCollector
Webhook Class A discord.js WebhookClient
escapeMarkdown function A discord.js escape markdown function
splitMessage function A discord.js split message function

readonly owner :external:User

The owner for this bot

permStructure :PermissionStructure

The permStructure Komada will take into account when commands are ran and permLevel is calculated.

providers :external:Collection

The collection of providers that can be used in Komada

ready :Boolean

Whether or not Komada is completely ready to accept commands from users or not. This will be true after everything is initialized correctly.

settings :Object

The object where the gateways are stored settings

Methods

async login(token)

Use this to login to Discord with your bot
Parameters:
Name Type Description
token string Your bot token

sweepCommandMessages(lifetime) → {number}

Sweeps command messages based on the lifetime parameter
Parameters:
Name Type Description
lifetime number The threshold for how old command messages can be before sweeping since the last edit in seconds
Returns:
number - The amount of messages swept

Type Definitions

Options

Properties:
Name Type Attributes Default Description
prefix string <optional>
? The prefix for Komada. Defaults to '?'.
ownerID string <optional>
String The bot owner's ID, Komada will autofetch it if it's not specified.
disabled Komada.OptionsDisabled <optional>
{} The disabled pieces.
permStructure PermissionLevels | Array.<{}> <optional>
Array<{}> The PermStructure for Komada.
selfbot boolean <optional>
boolean Whether the bot is a selfbot or not. Komada detects this automatically.
readyMessage function <optional>
function A custom function with a client argument that allows you to customize the ready string when Komada logs in.
commandMessageLifetime number <optional>
1800 The lifetime for the command messages, in milliseconds.
commandMessageSweep number <optional>
900 How frequent should Komada sweep the command messages.
disableLogTimestamps boolean <optional>
false Whether the komada logger should show the timestamps.
disableLogColor boolean <optional>
false Whether the komada logger should show colours.
cmdEditing boolean <optional>
false Whether Komada should consider edited messages as potential messages able to fire new commands.
cmdPrompt boolean <optional>
false Whether Komada should prompt missing/invalid arguments at failed command execution.
clientBaseDir string <optional>
path.dirname(require.main.filename) Directory where client pieces are stored. Can be an absolute or relative path. Defaults to the location of the index.js/app.js
provider Komada.OptionsProviders <optional>
{} The engines for SettingGateway, 'engine' for Persistent Data, 'cache' for Cache Engine (defaults to Collection)

OptionsDisabled

Properties:
Name Type Attributes Default Description
commands Array.<string> <optional>
Array Disabled Commands
events Array.<string> <optional>
Array Disabled Events
functions Array.<string> <optional>
Array Disabled Functions
inhibitors Array.<string> <optional>
Array Disabled Inhibitors
finalizers Array.<string> <optional>
Array Disabled Finalizers
monitors Array.<string> <optional>
Array Disabled Monitors
providers Array.<string> <optional>
Array Disabled Providers
extendables Array.<string> <optional>
Array Disabled Extendables

OptionsProviders

Properties:
Name Type Attributes Default Description
engine string <optional>
json The Provider Engine SettingGateway will use to store and access to the persistent data.
cache string <optional>
js The Provider Cache Engine CacheManager from SettingGateway will use to cache the data.