Telegram.Bot
Telegram.Bot copied to clipboard
SendTextMessage method not work in CallbackQuery
I trying to show 'InlineKeyboard'
and want if user choose each button do something and 'SendTextMessage'
but it not works and not send message(not show any message)
What's wrong?
public async Task<IHttpActionResult> Post(Update update)
{
try
{
var message = update.Message;
var pages = GeneratePagination(50, 5);
await Bot.Api.SendTextMessage(message.Chat.Id,
"", false, false, 0, pages);
if (update.Type == UpdateType.CallbackQueryUpdate)
{
if (message.Text == "1")
{
await Bot.Api.SendTextMessage(message.Chat.Id,
"this is page 1");
}
else if (message.Text == "2")
{
await Bot.Api.SendTextMessage(message.Chat.Id,
"this is page 2");
}
}}
Did you checked simple SendTextMessage is working for you?
i solved problem. instead of using await Bot.Api.SendTextMessage(message.Chat.Id, "this is page 1");
i use await Bot.Api.SendTextMessage( update.CallbackQuery.Message.Chat.Id, "this is page 1");
and work
Thanks