RandomMessageResponder

RandomMessageResponder

Class representing a bot random message responder. Random message responders always reply with a randomly selected canned message from a list. See https://api.slack.com/docs/messages for information on Slack message formatting.

Constructor

new RandomMessageResponder(options)

Create a bot random message responder.
Source:
Parameters:
Name Type Description
options Object The responder options.
Name Type Attributes Description
messages Array.<String> | Array.<Object> The messages to respond with, one will be randomly picked each time.
alias String | Alias <optional>
The alias to respond with. This must be either an Alias or the name of one registered the bot.
Example

Create a random message responder

new Bot.Responder.RandomMessage({
    messages: [
        'Hello World!',
        'Goodbye World!'
    ]
});

Extends

Methods

(static) create() → {RandomMessageResponder}

Create a bot random message responder (see RandomMessageResponder for parameters).
Source:
Returns:
Type:
RandomMessageResponder
The new random message responder.

(async) respond(message) → {Promise}

Respond to an incoming message with a random responder message.
Overrides:
Source:
Parameters:
Name Type Description
message Object The Slack message to respond to.
Returns:
Type:
Promise
A promise which resolves when the message is sent.