@@ -60,7 +60,7 @@ export class FacebookBot {
6060 // console.log('dispatching..');
6161 if ( messaging . optin ) {
6262 let user = this . getNewUserFromMessage ( messaging ) ;
63- return this . botController . newUser ( user ) ;
63+ return this . botController . newUser ( user , reply ) ;
6464
6565 }
6666 if ( messaging . message ) {
@@ -76,34 +76,35 @@ export class FacebookBot {
7676 return this . dispatchAttachmentMessage ( messaging ) ;
7777 }
7878 }
79- return ( this . botController . catchAll ) ? this . botController . catchAll ( this . getUserFromMessage ( messaging ) , messaging ) : null ;
79+ return ( this . botController . catchAll ) ? this . botController . catchAll ( this . getUserFromMessage ( messaging ) , messaging , reply ) : null ;
8080 }
8181
8282
8383 private dispatchAttachmentMessage ( messaging : IFbMessaging ) {
8484 let user = this . getUserFromMessage ( messaging ) ;
85+ let reply : FacebookReply = new FacebookReply ( messaging . sender . id , this . fbApi ) ;
8586 for ( var attachment of messaging . message . attachments ) {
8687 switch ( attachment . type ) {
8788 case FB_ATTACHMENT_TYPE . IMAGE :
8889 let imageMessage = {
8990 user, link : { url : attachment . payload . url }
9091 } ;
91- this . botController . imageMessage ( imageMessage ) || null ;
92+ this . botController . imageMessage ( imageMessage , reply ) || null ;
9293 break ;
9394 case FB_ATTACHMENT_TYPE . LOCATION :
9495 let location = {
9596 user, location : { coordinates : attachment . payload . coordinates }
9697 } ;
97- ( this . botController . locationMessage ) ? this . botController . locationMessage ( location ) : null ;
98+ ( this . botController . locationMessage ) ? this . botController . locationMessage ( location , reply ) : null ;
9899 break ;
99100 case null :
100101 if ( attachment . payload === null ) {
101102 let link = { user, link : { url : attachment . url , title : attachment . title } } ;
102- ( this . botController . linkMessage ) ? this . botController . linkMessage ( link ) : null ;
103+ ( this . botController . linkMessage ) ? this . botController . linkMessage ( link , reply ) : null ;
103104 }
104105 break ;
105106 default :
106- ( this . botController . catchAll ) ? this . botController . catchAll ( user , messaging ) : null ;
107+ ( this . botController . catchAll ) ? this . botController . catchAll ( user , messaging , reply ) : null ;
107108 break ;
108109 }
109110 }
0 commit comments