Skip to content
Open
Changes from all commits
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
8 changes: 6 additions & 2 deletions lib/facebot.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ Facebot.prototype.respondToCreateChatMessages = function(message) {
var requiredUsers = [this.user.id, this.authorised_user.id];

// Parse the friend name: "@facebot chat captain planet" becomes "captain planet"
var any_chat = message.text.indexOf('chat_any ') != -1;
if (any_chat)
message.text = message.text.replace('chat_any ','chat ');
var friendname = message.text
.substring(message.text.indexOf('chat') + 'chat'.length)
.trim();
Expand All @@ -368,7 +371,7 @@ Facebot.prototype.respondToCreateChatMessages = function(message) {
if (!isTruelyPrivate)
throw new Error('The channel should only contain you and me.');
})
.then(() => fbUtil.findFBUser(this.facebookApi, friendname))
.then(() => fbUtil.findFBUser(this.facebookApi, friendname, any_chat))
.then(friend => {
this.channelLinks.push({
slack_channel: message.channel,
Expand Down Expand Up @@ -439,7 +442,7 @@ Facebot.prototype.dispatchBotCommands = function(message) {
Facebot.prototype.respondToCommands = function(command, message) {
if (command === 'list') return this.postListOfLinkedChannels(message);

if (command === 'chat') return this.respondToCreateChatMessages(message);
if (command === 'chat' || command === 'chat_any') return this.respondToCreateChatMessages(message);

if (command == 'unlink') return this.respondToUnlinkCommands(message);

Expand All @@ -450,6 +453,7 @@ Facebot.prototype.respondToCommands = function(command, message) {
if (command === 'help') {
response = '`@facebot help`: See this text\n' +
'`@facebot chat <friend name>`: Connect a private channel with a facebook friend\n' +
'`@facebot chat_any <name>`: Connect a private channel with a facebook friend, non-friend, or bot\n' +
'`@facebot unlink`: Disconnects the current channel from facebook messages\n' +
'`@facebot status`: Show facebook connectivity status\n' +
'`@facebot list`: Shows information about linked chats\n' +
Expand Down