我有webhook电报bot,但是InlineKeyboardMarkup不起作用。 它显示了一个键盘,但是按钮什么也没做。
代码: 1.键盘
public static InlineKeyboardMarkup rkm = new InlineKeyboardMarkup(new[]
{
// first row
new []
{
InlineKeyboardButton.WithCallbackData("Login As Admin", "callbackLoginAsAdmin"),
InlineKeyboardButton.WithCallbackData("Check regestration", "callbackCheck"),
},
// second row
new []
{
InlineKeyboardButton.WithCallbackData("help", "callbackHelp"),
InlineKeyboardButton.WithCallbackData("RandomSticker", "callbackRandomSticker"),
}
});
更新
public async Task<OkResult> Update(Update update)
{
if (update.Message.Date >= Bot.StartTime && update.Type == UpdateType.Message)
{
...
}
else if (update.CallbackQuery != null )
{
var client = await Bot.Get();
var Callback = update.CallbackQuery;
//await client.AnswerCallbackQueryAsync(Callback.Id, "works", true);
await client.SendTextMessageAsync("chat id", "works");
}
return Ok();
}
} }
如果要按下任何按钮,我只是想发送“作品”。