Constructor
new ChatHandler(botopt, optionsopt)
Properties:
Name | Type | Description |
---|---|---|
bot |
Bot |
The bot |
awaits |
Object |
The active awaits |
Creates a new ChatHandler
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bot |
Bot | <optional> |
The main client |
||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object | <optional> |
The configuration to use Properties
|
Methods
awaitMessage(trigger, action, timeoutopt) → {Number}
Add an await, which will trigger under certain conditions
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
trigger |
function |
A function that takes a Message and returns a Boolean |
|
action |
function |
A function to be executed when |
|
timeout |
Number | <optional> |
Delete the await after this many milliseconds |
Returns:
The unique id of the await
- Type
- Number
getHelp(message) → {Promise}
Generate and send a help message
Parameters:
Name | Type | Description |
---|---|---|
message |
Message |
The message to respond to |
Returns:
The sent message
- Type
- Promise
run()
Starts listening for messages
stop()
Stops listening for messages