我是电报机器人的新手,想为我的机器人创建自定义键盘,为此目的写下这段代码:
var rkm = new ReplyKeyboardMarkup();
rkm.Keyboard =
new KeyboardButton[][]
{
new KeyboardButton[]
{
new KeyboardButton("1-1"),
new KeyboardButton("1-2")
},
new KeyboardButton[]
{
new KeyboardButton("2")
},
new KeyboardButton[]
{
new KeyboardButton("3-1"),
new KeyboardButton("3-2"),
new KeyboardButton("3-3")
}
};
WebRequest req = WebRequest.Create("https://api.telegram.org/bot" + "282189232:AAGdsdsdsdVOrsxy2rzU75QUAnWL_F2vo" + "/sendMessage?chat_id=" + chat_id + "&text=" + message + "&reply_markup=" + rkm);
req.UseDefaultCredentials = true;
var result = req.GetResponse();
req.Abort();
但是当我在这一行中运行该代码时:
var result = req.GetResponse();
得到此错误:
远程服务器返回错误:(400)错误请求。
我该如何解决这个问题?
答案 0 :(得分:0)
正如所建议的那样使用MrRoundRobin的库。以下是你将如何做到这一点:
TextBox