Bridge

Bridge

Middleware manager for commands

Constructor

new Bridge(client)

Source:
Properties:
Name Type Description
tasks Array

An array of middleware

collectors Array

An array of message collectors

Creates a new Bridge instance

Parameters:
Name Type Description
client Client

Client instance

Methods

collect(options) → {Collector}

Source:

Creates a message collector

Parameters:
Name Type Description
options Object

Collector options

Properties
Name Type Attributes Default Description
filter String

The filter function to pass all messages through

channel String <optional>

The channel ID to filter messages from

author String <optional>

The author ID to filter messages from

tries Number <optional>
10

Max number of attempts to filter a message

time Number <optional>
60

Max length of time to wait for messages, in seconds

matches Number <optional>
10

Max number of successful filtered messages

Returns:

Message collector object

Type
Collector

destroy()

Source:

Destroy all tasks and collectors

handle(container) → {Promise.<Container>}

Source:

Collects and executes messages after running them through middleware

Parameters:
Name Type Description
container Container

The message container

Returns:
Type
Promise.<Container>

push(middleware)

Source:

Inserts new middleware to the task queue according to ascending priority (lower numbers are earlier in queue)

Parameters:
Name Type Description
middleware Middleware

Middleware object

register(middleware) → {Client}

Source:

Registers middleware

Parameters:
Name Type Description
middleware String | Object | Array

An object, array or relative path to a folder or file to load middleware from

Returns:
Type
Client

reload() → {Client}

Source:

Reloads middleware files (only those that have been added from by file path)

Returns:
Type
Client

run()

Source:

Starts running the bridge

stop()

Source:

Stops running the bridge

unregister(name) → (nullable) {Middleware}

Source:

Remove middleware by name and returns it if found

Parameters:
Name Type Description
name String | Boolean

Middleware name, will remove all if true

Returns:
Type
Middleware