SHARE
TWEET

Untitled

a guest Jan 21st, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var replyMessage =  incomingMessage.CreateReplyMessage("Yo, I heard you.");
  2.    
  3. replyMessage.ChannelData = {custom Telegram JSON}
  4.    
  5. {
  6.     var reply = context.Context.Activity.CreateReply(messageText);
  7.  
  8.     if (BotDialogHelpers.ExtractMessengerFromDialogContext(context) == BotDialogHelpers.Messengers.Telegram)
  9.     {
  10.         GenerateReplyMarkupForTelegram(reply);
  11.     }
  12.  
  13.     await context.Context.SendActivityAsync(reply, token);
  14. }
  15.  
  16. /// <summary>
  17. /// https://docs.microsoft.com/en-us/azure/bot-service/dotnet/bot-builder-dotnet-channeldata?view=azure-bot-service-3.0
  18. /// https://core.telegram.org/bots/api#message sendMessage reply_markup
  19. /// </summary>
  20. private void GenerateReplyMarkupForTelegram(IActivity reply)
  21. {
  22.     var replyMarkup = new
  23.     {
  24.         reply_markup = new
  25.         {
  26.             remove_keyboard = true,
  27.         }
  28.     };
  29.  
  30.     var channelData = new
  31.     {
  32.         method = "sendMessage",
  33.         parameters = replyMarkup,
  34.     };
  35.  
  36.     reply.ChannelData = JObject.FromObject(channelData);
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top