Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 基于bot框架的电报聊天键盘_C#_Telegram Bot_Botframework - Fatal编程技术网

C# 基于bot框架的电报聊天键盘

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(

我尝试使用botframework显示键盘聊天电报,但没有显示键盘。我试着像这样发送keybord:

        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,
内容=卡片
});
回复;