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
|
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