public FacebookPayload[] GetFacebook(int count) { var list = new List <FacebookPayload>(count); for (int i = 0; i < count; i++) { list.Add(FacebookPayload.Create()); } return(list.ToArray()); }
protected virtual async Task OnFacebookThreadControlRequest(ITurnContext turnContext, FacebookPayload facebookPayload, CancellationToken cancellationToken) { Logger.LogInformation("Thread Control Request message received."); // TODO: Your Thread Control Request event handling logic here... if (facebookPayload.RequestThreadControl.RequestOwnerAppId == _configuration["SecondaryFacebookAppId"]) { await FacebookThreadControlHelper.PassThreadControlToBot(turnContext, _configuration["PrimaryPageToken"], facebookPayload.RequestThreadControl.RequestOwnerAppId, facebookPayload.Sender.Id, "allowing thread control"); } else { Logger.LogInformation($"Thread Control Request denied. Only allowed for {_configuration["SecondaryFacebookAppId"]}"); } }
protected virtual async Task OnFacebookThreadControlRequest(ITurnContext turnContext, FacebookPayload facebookPayload, CancellationToken cancellationToken) { _logger.LogInformation("PrimaryBot - Thread Control Request message received."); string requestedOwnerAppId = facebookPayload.RequestThreadControl.RequestedOwnerAppId; if (facebookPayload.RequestThreadControl.Metadata == "please") { await turnContext.SendActivityAsync($"Primary Bot: {requestedOwnerAppId} requested thread control nicely. Passing thread control..."); var success = await FacebookThreadControlHelper.PassThreadControlAsync( _configuration["FacebookPageToken"], requestedOwnerAppId, facebookPayload.Sender.Id, "allowing thread control"); if (!success) { // Account for situations when the primary receiver doesn't have thread control await turnContext.SendActivityAsync("Primary Bot: Thread control could not be passed."); } } else { await turnContext.SendActivityAsync($"Primary Bot: {requestedOwnerAppId} requested thread control but did not ask nicely." + " Thread control will not be passed." + " Send any message to continue."); } }