Global

Decorators

deprecatedClass(message?: string) → ClassDecorator

Logs a deprecation warning for the decorated class if an instance is created

Parameters:
Name Type Attributes Description
message
string
<optional>

Class deprecation message

Source:
Decorator type:
ClassDecorator

deprecatedMethod(message?: string) → MethodDecorator

Logs a deprecation warning for the decorated class method if it is called within the current process

Parameters:
Name Type Attributes Description
message
string
<optional>

Method deprecation message

Source:
Decorator type:
MethodDecorator

logger

Property decorator that will automatically assign the Logger singleton instance to the decorated class property

Example:

class Foo {
    @logger private readonly logger: Logger;
    ...

Note: This is a Typescript feature. If using the logger is desired in Javascript you should simply retrieve the singleton instance via Logger.instance()

Source:
Decorator type:
PropertyDecorator

Type Definitions

ArgOpts

Object containing options for controlling how command arguments will be parsed

Type:
Object
Properties:
Name Type Attributes Default Description
separator
string
<optional>
' '

The charactor to separate args by

Source:

BaseResolverType

Valid argument resolver types for use with resolve and expect. Can be one of the following string literals:

'String'
| 'Number'
| 'Boolean'
| 'Duration'
| 'User'
| 'Member'
| 'BannedUser'
| 'Channel'
| 'Role'
| 'Command'
| 'CommandGroup'
| 'Any'

or an Array of possible string literal values

Type:
string
Source:

BaseStrings

Enum containing all base framework localization string keys

Type:
enum
Source:

CommandInfo

Object containing required Command properties to be passed to a Command on construction

Type:
Object
Properties:
Name Type Attributes Default Description
name
string

See: Command#name

desc
string

See: Command#desc

usage
string

See: Command#usage

info
string
<optional>

See: Command#info

group
string
<optional>
'base'

See: Command#group

aliases
string[]
<optional>
[]

See: Command#aliases

guildOnly
boolean
<optional>
false

See: Command#guildOnly

hidden
boolean
<optional>
false

See: Command#hidden

argOpts
ArgOpts
<optional>

See: Command#argOpts, ArgOpts

callerPermissions
PermissionResolvable[]
<optional>
[]

See: Command#callerPermissions

clientPermissions
PermissionResolvable[]
<optional>
[]

See: Command#clientPermissions

roles
string[]
<optional>
[]

See: Command#roles

ownerOnly
boolean
<optional>
false

See: Command#ownerOnly

ratelimit
string
<optional>

Sets a rate limit on calls to this command for every user

lockTimeout
number
<optional>
30000

The time until command locks will expire automatically

Source:

DefaultGuildSettings

The default settings to apply to new guilds. Stored under the key 'defaultGuildSettings' in Client#storage

Type:
Object
Properties:
Name Type Attributes Default Description
prefix
string
'/'

Prefix denoting a command call

disabledGroups
string[]
<optional>
[]

Command groups to ignore

Source:

Difference

Represents a difference between two given valid Unix time signatures

Type:
Object
Properties:
Name Type Attributes Description
raw
number

Total number of MS difference

days
number
<nullable>

Number of days spanned

hours
number
<nullable>

Number of hours spanned after higher units are subtracted

minutes
number
<nullable>

Number of minutes spanned after higher units are subtracted

secs
number
<nullable>

Number of seconds spanned after higher units are subtracted

ms
number

Number of ms spanned after higher units are subtracted

toString()
function

Returns duration formatted as # days, # hours, # mins, # secs

toSimplifiedString()
function

Returns duration formatted as #d #h #m #s

Source:

LocalizedCommandInfo

Represents an object containing localization overrides for a command's desc, info, and usage fields

Type:
object
Source:

LogData

Represents an object passed from the Logger to the TransportFunction of any Transports given to it

Type:
object
Properties:
Name Type Description
timestamp
Date

Holds the time/date for this log

type
string

The log type. Will be one of: LOG | INFO | WARN | ERROR | DEBUG

tag
string

The tag given for this log

text
string

The text content of this log

Source:

LogLevel

Enum containing the different levels of potential logger output. Each level represents itself and everything above it in the enum. The default logger log level is LogLevel.LOG

enum LogLevel
{
    NONE,
    LOG,
    INFO,
    WARN,
    ERROR.
    DEBUG
}
Type:
enum
Source:

MiddlewareFunction

A function that takes a Message object and an array of args, does anything with them, and returns a Tuple where the first item is the Message object and the second item is the array of args

(Message, any[]) => [Message, any[]]

Can be async as long as the returned promise resolves with the tuple containing the message object and the args array as expected.

If a middleware function returns a string, or throws a string/error, it will be sent to the calling channel as a message and the Command execution will be aborted. If a middleware function does not return anything or returns something other than an array or string, the Command will fail silently.

Note: The command dispatcher will attempt to bind the Command instance to the middleware function when called, so this within a middleware function (if it is not an arrow function) will be the Command instance at runtime

Source:

PluginConstructor

Any class that extends and implements Plugin. Not to be confused with an instance of a Plugin.

Source:

ResolverConstructor

Any class that extends and implements Resolver. Not to be confused with an instance of a Resolver.

Source:

ResourceLoader

Represents a function assigned to a specific language that takes a string key and an optional TemplateData object and returns a localized string for that language if it exists

Deprecated:
Source:

ResourceProxy

A Proxy where calling functions will treat the function name as a Lang string key and act as a ResourceLoader, requiring only the strings TemplateData (or nothing for non-dynamic strings)

TypeScript users can pass a generic type parameter to the ResourceProxy type which will append all the keys of the passed type to the valid keys on the ResourceProxy itself. This makes it easier to get type hinting for custom localization strings. Example:

type C = {
    FOO: any;
    BAR: any;
};
...
let r: ResourceProxy<C> = Lang.createResourceProxy('en_us');
return r.FOO(); // `FOO` will be of type `(data?: TemplateData) => string`
                // so this returns a string
Type:
object
Source:

RespondOptions

Object consisting of MessageOptions and an optional button string field for compact mode support

Type:
object
Properties:
Name Type Attributes Description
button
string
<optional>

Unicode emoji string, custom enoji ID, or a key from the Client's buttons map

Source:

StorageProviderConstructor

Any class that extends and implements StorageProvider and provides an interface with a storage medium allowing data to be stored, retrieved, and manipulated. Not to be confused with an instance of a storage provider.

Source:

TemplateData

Represents an object mapping template keys to values, where the template keys will be replaced with the provided values in the source string when given to a Lang resource function/proxy like Lang.res()

Type:
object
Source:

Transport

Represents a transport object for the Logger.

Type:
object
Properties:
Name Type Attributes Description
transport
TransportFunction

The transport function to use for this transport

level
LogLevel
<optional>

The log level for this transport. Will default dynamically to the Logger's log level if none is provided

Source:

TransportFunction(data: LogData)

Represents a function to be included in a Transport object. This function will be given a LogData object at runtime whenever a logger method is called. What is done with that log data is entirely up to you as the developer, but logging to a file. to a database, or even to a Discord channel would be some good examples

Parameters:
Name Type Description
data
LogData

The data received from the logger

Source:

Tuple

Represents an array of fixed length where the the item in the specified position is of the specified type.

Example:

['foo', 10] === [string, number] === Tuple<string, number>
Type:
any[]
Source:

YAMDBFOptions

Object containing required Client properties to be passed to a Client on construction

Type:
Object
Properties:
Name Type Attributes Default Description
token
string
<optional>

Token needed to connect the Client to Discord

owner
string[]
<optional>
[]

Can also be a single string
See: Client#owner

provider
StorageProviderConstructor
<optional>

See: Client#provider

commandsDir
string
<optional>

See: Client#commandsDir

eventsDir
string
<optional>

See: Client#eventsDir

localeDir
string
<optional>

See: Client#localeDir

defaultLang
string
<optional>

See: Client#defaultLang

statusText
string
<optional>
null

See: Client#statusText

readyText
string
<optional>
'Client ready!'

See: Client#readyText

unknownCommandError
boolean
<optional>
true

See: Client#unknownCommandError

dmHelp
boolean
<optional>
true

See: Client#dmHelp

passive
boolean
<optional>
false

See: Client#passive

pause
boolean
<optional>
false

See: Client#pause

disableBase
string[]
<optional>
[]

See: Client#disableBase

ratelimit
string
<optional>

Sets a global rate limit on command calls for every user

logLevel
LogLevel
<optional>

Sets the logging level for the logger. Defaults to LogLevel.DEBUG

plugins
Array<(PluginConstructor|string)>
<optional>
[]

An array of Plugin classes (not instances) or plugin package name strings to be loaded and used

customResolvers
ResolverConstructor[]
<optional>
[]

An array of Resolver classes (not instances)

argsParser
function
<optional>

Function taking an input string, an optional Command object, and an optional Message object that returns an array of argument strings. Should be used instead of middleware for providing an alternative to the default args parsing of splitting input on the Command's specified argument separator

buttons
object
<optional>

Object mapping keys for easy access to unicode emoji strings or custom emoji id strings. To be used by the Client when compact mode is active
See: Client#buttons

compact
boolean
<optional>
false

Whether or not compact mode should be used

tsNode
boolean
<optional>
false

Whether or not ts-node is being used, allowing the CommandLoader to attempt to load .ts files when loading Commands

Source: