ImageResponder

ImageResponder

Class representing a bot image responder. Image responders always reply with the same image as a Slack attachment.

Constructor

new ImageResponder(options)

Create a bot image responder.
Source:
Parameters:
Name Type Description
options Object The responder options.
Name Type Attributes Description
image String The URL of the image to respond with.
label String <optional>
Text to show alongside the image.
color String <optional>
The color of the image attachment, a hex code including the preceeding "#".
alias String | Alias <optional>
The alias to respond with. This must be either an Alias or the name of one registered the bot.
Examples

Create an image responder

new Bot.Responder.Image({
    image: 'https://i.imgur.com/ydM3Wb4.gif'
});

Create an image responder with an alias and additional configurations

new Bot.Responder.Image({
    alias: 'GoatBot',
    image: 'https://i.imgur.com/ydM3Wb4.gif',
    label: 'Some cute goats',
    color: '#ffced8'
});

Extends

Methods

(static) create() → {ImageResponder}

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

(async) respond(message) → {Promise}

Respond to an incoming message with the 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.