@@ -136,11 +136,12 @@ class BotiumConnectorDirectline3 {
136136 } else if ( a . contentType === 'application/vnd.microsoft.card.adaptive' ) {
137137 const textBlocks = this . _deepFilter ( a . content . body , ( t ) => t . type , ( t ) => t . type === 'TextBlock' )
138138 const imageBlocks = this . _deepFilter ( a . content . body , ( t ) => t . type , ( t ) => t . type === 'Image' )
139+ const buttonBlocks = this . _deepFilter ( a . content . body , ( t ) => t . type , ( t ) => t . type . startsWith ( 'Action.' ) )
139140
140141 botMsg . cards . push ( {
141142 text : textBlocks && textBlocks . map ( t => t . text ) ,
142143 image : imageBlocks && imageBlocks . length > 0 && mapImage ( imageBlocks [ 0 ] ) ,
143- buttons : a . content . actions && a . content . actions . map ( mapButton )
144+ buttons : ( ( a . content . actions && a . content . actions . map ( mapButton ) ) || [ ] ) . concat ( ( buttonBlocks && buttonBlocks . map ( mapButton ) ) || [ ] )
144145 } )
145146 } else if ( a . contentType === 'application/vnd.microsoft.card.animation' ||
146147 a . contentType === 'application/vnd.microsoft.card.audio' ||
@@ -243,9 +244,7 @@ class BotiumConnectorDirectline3 {
243244 UserSays ( msg ) {
244245 debug ( 'UserSays called' )
245246 return new Promise ( async ( resolve , reject ) => {
246- const activity = {
247- from : { id : this . me }
248- }
247+ const activity = msg . sourceData || { }
249248 if ( msg . buttons && msg . buttons . length > 0 && ( msg . buttons [ 0 ] . text || msg . buttons [ 0 ] . payload ) ) {
250249 let payload = msg . buttons [ 0 ] . payload || msg . buttons [ 0 ] . text
251250 try {
@@ -255,13 +254,16 @@ class BotiumConnectorDirectline3 {
255254 activity . type = this . caps [ Capabilities . DIRECTLINE3_BUTTON_TYPE ]
256255 activity [ this . caps [ Capabilities . DIRECTLINE3_BUTTON_VALUE_FIELD ] ] = payload
257256 } else {
258- if ( msg . sourceData && msg . sourceData . type ) {
259- activity . type = msg . sourceData . type
260- } else {
257+ if ( ! activity . type ) {
261258 activity . type = 'message'
262259 }
263260 activity . text = msg . messageText
264261 }
262+ if ( ! activity . from ) {
263+ activity . from = { id : this . me }
264+ } else if ( ! activity . from . id ) {
265+ activity . from . id = this . me
266+ }
265267
266268 if ( msg . forms ) {
267269 activity . value = { }
0 commit comments