This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From https://github.com/howdyai/botkit#botreply | |
bot.reply(message,{ | |
text: "A more complex response", | |
username: "ReplyBot", | |
icon_emoji: ":dash:", | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From https://github.com/howdyai/botkit#receiving-messages | |
controller.on('direct_message',function(bot,message) { | |
// reply to _message_ by using the _bot_ object | |
bot.reply(message,'You are talking directly to me'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From https://github.com/howdyai/botkit#receiving-messages | |
controller.on('direct_mention',function(bot,message) { | |
// reply to _message_ by using the _bot_ object | |
bot.reply(message,'I heard you mention me!'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
random.choice(array) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From https://github.com/howdyai/botkit#receiving-messages | |
controller.on('message_received', function(bot, message) { | |
bot.reply(message, 'I heard... something!'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/* "dependencies": { | |
"botkit": "0.0.7", | |
"escape-string-regexp": "^1.0.5", | |
"lodash": "^4.5.1", | |
"mongodb": "^2.1.7", | |
"sentiment": "^1.0.6", | |
} | |
*/ | |
var _ = require('lodash'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
______ ______ ______ __ __ __ ______ | |
/\ == \ /\ __ \ /\__ _\ /\ \/ / /\ \ /\__ _\ | |
\ \ __< \ \ \/\ \ \/_/\ \/ \ \ _"-. \ \ \ \/_/\ \/ | |
\ \_____\ \ \_____\ \ \_\ \ \_\ \_\ \ \_\ \ \_\ | |
\/_____/ \/_____/ \/_/ \/_/\/_/ \/_/ \/_/ | |
This is a sample Slack bot built with Botkit. | |
This bot demonstrates many of the core features of Botkit: | |
* Connect to Slack using the real time API | |
* Receive messages based on "spoken" patterns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
controller.hears('open the (.*) doors',['message_received'],function(bot,message) { | |
var doorType = message.match[1]; //match[1] is the (.*) group. match[0] is the entire group (open the (.*) doors). | |
if (doorType === 'pod bay') { | |
return bot.reply(message, 'I\'m sorry, Dave. I\'m afraid I can\'t do that.'); | |
} | |
return bot.reply(message, 'Okay'); | |
}); |