C# 基于bot框架的电报聊天键盘
我尝试使用botframework显示键盘聊天电报,但没有显示键盘。我试着像这样发送keybord:C# 基于bot框架的电报聊天键盘,c#,telegram-bot,botframework,C#,Telegram Bot,Botframework,我尝试使用botframework显示键盘聊天电报,但没有显示键盘。我试着像这样发送keybord: Activity reply = activity.CreateReply(message); var keyboard =new ReplyKeyboardMarkup { Keyboard = new[] { new[] { new KeyboardButton("Text1"), new KeyboardButton(
Activity reply = activity.CreateReply(message);
var keyboard =new ReplyKeyboardMarkup
{
Keyboard = new[] { new[] { new KeyboardButton("Text1"), new KeyboardButton("text1") } }
};
reply.ChannelData = keyboard;
await connector.Conversations.ReplyToActivityAsync(reply);
还有很多其他的方法。但键盘并没有显示出来
原因可能是什么?如何显示它?您不需要使用ChannelData。只需发送卡片上的按钮:
var card = new HeroCard("Some Text");
card.Buttons = new List<CardAction>()
{
new CardAction()
{
Title = "button1",
Type=ActionTypes.ImBack,
Value="button1"
},
new CardAction()
{
Title = "button2",
Type=ActionTypes.ImBack,
Value="button2"
}
};
var reply = activity.CreateReply("");
reply.Attachments = new List<Attachment>();
reply.Attachments.Add(new Attachment()
{
ContentType = HeroCard.ContentType,
Content = card
});
return reply;
var-card=new-HeroCard(“一些文本”);
card.Buttons=新列表()
{
新行动
{
Title=“button1”,
Type=ActionTypes.ImBack,
Value=“button1”
},
新行动
{
Title=“button2”,
Type=ActionTypes.ImBack,
Value=“button2”
}
};
var reply=activity.CreateReply(“”);
reply.Attachments=新列表();
reply.Attachments.Add(新附件()
{
ContentType=HeroCard.ContentType,
内容=卡片
});
回复;