File tree Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -124,11 +124,11 @@ export async function $process<TPlugin extends IPlugin>(
124124 }
125125
126126 const send = context . send . bind ( context ) ;
127- context . send = async ( activity : ActivityLike ) => {
128- const res = await send ( activity ) ;
127+ context . send = async ( activity : ActivityLike , conversationRef ?: ConversationReference ) => {
128+ const res = await send ( activity , conversationRef ) ;
129129
130130 this . onActivitySent ( sender , {
131- ...ref ,
131+ ...( conversationRef ?? ref ) ,
132132 sender,
133133 activity : res ,
134134 } ) ;
Original file line number Diff line number Diff line change @@ -535,17 +535,19 @@ export class App<TPlugin extends IPlugin = IPlugin> {
535535 return res . token ;
536536 }
537537
538- protected async getOrRefreshTenantToken ( tenantId ? : string ) {
538+ protected async getOrRefreshTenantToken ( tenantId : string ) {
539539 let appToken =
540- this . tenantTokens . get ( tenantId || 'common' ) || this . _tokens . graph ?. toString ( ) ;
541- if ( this . credentials && ! appToken ) {
540+ this . tenantTokens . get ( tenantId ) ;
541+ if ( this . credentials && ! this . tenantTokens . get ( tenantId ) ) {
542542 const { access_token } = await this . api . bots . token . getGraph ( {
543543 ...this . credentials ,
544544 tenantId : tenantId ,
545545 } ) ;
546546
547+ this . log . debug ( `refreshing tenant token for ${ tenantId } ` ) ;
548+
547549 appToken = access_token ;
548- this . tenantTokens . set ( tenantId || 'common' , access_token ) ;
550+ this . tenantTokens . set ( tenantId , access_token ) ;
549551 }
550552
551553 return appToken ;
Original file line number Diff line number Diff line change @@ -126,8 +126,9 @@ export interface IActivityContext<T extends Activity = Activity>
126126 /**
127127 * send an activity to the conversation
128128 * @param activity activity to send
129+ * @param conversationRef optional conversation reference to send the activity to. By default, it will use the activity's conversation reference.
129130 */
130- send : ( activity : ActivityLike ) => Promise < SentActivity > ;
131+ send : ( activity : ActivityLike , conversationRef ?: ConversationReference ) => Promise < SentActivity > ;
131132
132133 /**
133134 * reply to the inbound activity
@@ -199,8 +200,8 @@ export class ActivityContext<T extends Activity = Activity>
199200 }
200201 }
201202
202- async send ( activity : ActivityLike ) {
203- return await this . _plugin . send ( toActivityParams ( activity ) , this . ref ) ;
203+ async send ( activity : ActivityLike , conversationRef ?: ConversationReference ) {
204+ return await this . _plugin . send ( toActivityParams ( activity ) , conversationRef ?? this . ref ) ;
204205 }
205206
206207 async reply ( activity : ActivityLike ) {
@@ -286,7 +287,7 @@ export class ActivityContext<T extends Activity = Activity>
286287 ] ,
287288 } ) ,
288289 ] ,
289- }
290+ } , convo
290291 ) ;
291292 }
292293
You can’t perform that action at this time.
0 commit comments