Constructor
new Response(bot)
Create a bot response.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
bot |
Bot
|
The bot to use when responding. |
Examples
await Bot.Response.create(bot)
.to(message) // a Botkit message object
.as(alias) // an alias instance or the name of one
.with('Hello World!');
const bot = new Bot();
await bot.replyTo(message).with('Hello World!');
Methods
as(alias) → {Response}
Set an alias to respond with.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
alias |
String
|
Alias
|
The alias to respond with. This must be either an Alias or the name of one registered the bot. |
Throws:
-
Will throw if the alias is not known.
- Type
-
TypeError
to(incomingMessage) → {Response}
Set the incoming message to respond to.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
incomingMessage |
Object
|
The Slack message to respond to. |
Throws:
-
Will throw if incoming message is not a Slack message.
- Type
-
TypeError
with(outgoingMessage) → {Promise}
Set the outgoing message.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
outgoingMessage |
String
|
Object
|
The message to respond with. |
Throws:
-
Will throw if the outgoing message is invalid.
- Type
-
TypeError
Returns:
- Type:
-
Promise
A promise which resolves when the message is sent.