Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Enable use with web-based bots #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/botkit-middleware-witai.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ module.exports = function(config) {
var middleware = {};

middleware.receive = function(bot, message, next) {
// Only parse messages of type text and mention the bot.
// Only parse messages of type text and mention the bot (or when the bot is a web based bot where it's the only thing to talk to).
// Otherwise it would send every single message to wit (probably don't want that).
if (message.text && message.text.indexOf(bot.identity.id) > -1) {
if (message.text && (bot._controller._config.adapter.name === 'Web Adapter' || message.text.indexOf(bot.identity.id) > -1)) {
ddhogan marked this conversation as resolved.
Show resolved Hide resolved
client.message(message.text, function(error, data) {
if (error) {
next(error);
Expand Down