a text-friendly way to integrate actions with your bot. Supply an object of action-functions that can return synchronously or asynchronously and replace text in the response, generate new responses, or do what the response claims to do.
the following code does not work because it sees it as a promise waiting for fulfill to resolve, so nothing happens.
image: { // send an image
controller: async (params, next) => {
// remove tag from current message and wait for it to be sent
await next(null, '')
// now send image
let url
if (params.content.startsWith('http')) {
url = params.content
} else {
url = urlBase + params.content
}
const message = params.bot.createOutgoingMessageFor(params.update.sender.id)
message.addAttachmentFromUrl('image', url)
params.bot.sendMessage(message)
}
}
the following code does not work because it sees it as a promise waiting for fulfill to resolve, so nothing happens.