botframework
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -69,3 +69,3 @@ "use strict"; | ||
var user = this.getNewUserFromMessage(messaging); | ||
return this.botController.newUser(user); | ||
return this.botController.newUser(user, reply); | ||
} | ||
@@ -85,6 +85,7 @@ if (messaging.message) { | ||
} | ||
return (this.botController.catchAll) ? this.botController.catchAll(this.getUserFromMessage(messaging), messaging) : null; | ||
return (this.botController.catchAll) ? this.botController.catchAll(this.getUserFromMessage(messaging), messaging, reply) : null; | ||
}; | ||
FacebookBot.prototype.dispatchAttachmentMessage = function (messaging) { | ||
var user = this.getUserFromMessage(messaging); | ||
var reply = new FacebookReply(messaging.sender.id, this.fbApi); | ||
for (var _i = 0, _a = messaging.message.attachments; _i < _a.length; _i++) { | ||
@@ -97,3 +98,3 @@ var attachment = _a[_i]; | ||
}; | ||
this.botController.imageMessage(imageMessage) || null; | ||
this.botController.imageMessage(imageMessage, reply) || null; | ||
break; | ||
@@ -104,3 +105,3 @@ case interfaces_1.FB_ATTACHMENT_TYPE.LOCATION: | ||
}; | ||
(this.botController.locationMessage) ? this.botController.locationMessage(location_1) : null; | ||
(this.botController.locationMessage) ? this.botController.locationMessage(location_1, reply) : null; | ||
break; | ||
@@ -110,7 +111,7 @@ case null: | ||
var link = { user: user, link: { url: attachment.url, title: attachment.title } }; | ||
(this.botController.linkMessage) ? this.botController.linkMessage(link) : null; | ||
(this.botController.linkMessage) ? this.botController.linkMessage(link, reply) : null; | ||
} | ||
break; | ||
default: | ||
(this.botController.catchAll) ? this.botController.catchAll(user, messaging) : null; | ||
(this.botController.catchAll) ? this.botController.catchAll(user, messaging, reply) : null; | ||
break; | ||
@@ -117,0 +118,0 @@ } |
@@ -59,8 +59,8 @@ export interface IBotUser { | ||
export interface IBotController { | ||
newUser?(user: IBotUser): void; | ||
newUser?(user: IBotUser, reply: IBotReply): void; | ||
textMessage?(textMessage: ITextMessage, reply: IBotReply): void; | ||
imageMessage?(imageMessage: IImageMessage): void; | ||
linkMessage?(linkMessage: ILinkMessage): void; | ||
locationMessage?(locationMessage: ILocationMessage): void; | ||
catchAll?(user: IBotUser, msg: Object): void; | ||
imageMessage?(imageMessage: IImageMessage, reply: IBotReply): void; | ||
linkMessage?(linkMessage: ILinkMessage, reply: IBotReply): void; | ||
locationMessage?(locationMessage: ILocationMessage, reply: IBotReply): void; | ||
catchAll?(user: IBotUser, msg: Object, reply: IBotReply): void; | ||
} | ||
@@ -67,0 +67,0 @@ export interface IBotSettings { |
{ | ||
"name": "botframework", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Framework for messaging bots", | ||
@@ -42,2 +42,2 @@ "main": "./dist/es5/src/bot.js", | ||
} | ||
} | ||
} |
@@ -63,3 +63,3 @@ import {IBotController, IBotSettings, IBotUser, ITextMessage, IBotReply, IBotReplyListItem} from '../interfaces' | ||
let user = this.getNewUserFromMessage(messaging); | ||
return this.botController.newUser(user); | ||
return this.botController.newUser(user, reply); | ||
@@ -80,3 +80,3 @@ } | ||
} | ||
return (this.botController.catchAll) ? this.botController.catchAll(this.getUserFromMessage(messaging), messaging) : null; | ||
return (this.botController.catchAll) ? this.botController.catchAll(this.getUserFromMessage(messaging), messaging, reply) : null; | ||
} | ||
@@ -87,2 +87,3 @@ | ||
let user = this.getUserFromMessage(messaging); | ||
let reply: FacebookReply = new FacebookReply(messaging.sender.id, this.fbApi); | ||
for ( var attachment of messaging.message.attachments) { | ||
@@ -94,3 +95,3 @@ switch (attachment.type) { | ||
}; | ||
this.botController.imageMessage(imageMessage) || null; | ||
this.botController.imageMessage(imageMessage, reply) || null; | ||
break; | ||
@@ -101,3 +102,3 @@ case FB_ATTACHMENT_TYPE.LOCATION: | ||
}; | ||
(this.botController.locationMessage) ? this.botController.locationMessage(location) : null; | ||
(this.botController.locationMessage) ? this.botController.locationMessage(location, reply) : null; | ||
break; | ||
@@ -107,7 +108,7 @@ case null: | ||
let link = {user, link: {url: attachment.url, title: attachment.title}}; | ||
(this.botController.linkMessage) ? this.botController.linkMessage(link) : null; | ||
(this.botController.linkMessage) ? this.botController.linkMessage(link, reply) : null; | ||
} | ||
break; | ||
default: | ||
(this.botController.catchAll) ? this.botController.catchAll(user, messaging) : null; | ||
(this.botController.catchAll) ? this.botController.catchAll(user, messaging, reply) : null; | ||
break; | ||
@@ -114,0 +115,0 @@ } |
@@ -78,8 +78,8 @@ | ||
export interface IBotController { | ||
newUser?(user: IBotUser): void; | ||
newUser?(user: IBotUser, reply: IBotReply): void; | ||
textMessage?(textMessage: ITextMessage, reply: IBotReply): void; | ||
imageMessage?(imageMessage: IImageMessage): void; | ||
linkMessage?(linkMessage: ILinkMessage): void; | ||
locationMessage?(locationMessage: ILocationMessage): void; | ||
catchAll?(user: IBotUser, msg: Object): void; | ||
imageMessage?(imageMessage: IImageMessage, reply: IBotReply): void; | ||
linkMessage?(linkMessage: ILinkMessage, reply: IBotReply): void; | ||
locationMessage?(locationMessage: ILocationMessage, reply: IBotReply): void; | ||
catchAll?(user: IBotUser, msg: Object, reply: IBotReply): void; | ||
} | ||
@@ -86,0 +86,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
682575
53
14014