Yaser
Yaser

Reputation: 93

How can i answer "CallbackData" without use "AnswerCallbackQueryAsync" in telegram bot (C#)

the main problem is i want to send answer to user without showing by notification or alert in telegram , and i want to show message in main panel like other messages.

This line of code just fire a notification

  await api.AnswerCallbackQueryAsync(update.CallbackQuery.Id,"text");

How can i response to callback like this line code?

  await api.SendTextMessageAsync(update.Message.Chat.Id,"text");

Upvotes: 2

Views: 2206

Answers (1)

Muaath
Muaath

Reputation: 623

You should use that because this will stop loading GIF from telegram.

If you don't want to show alert, Leave text parameter null and it won't show alert.

then use SendTextMessageAsync method to send message to other messages.

Your code should be like this:

private void Bot_OnCallbackQuery(object sender, CallbackQueryEventArgs e)
{
    if (e.Query.Data == "Hello")
    {
        string reply = "Hi!";

        // Answer with null parameter:
        await Bot.AnswerCallbackQuery(e.Query.Id, null);

        // Reply with message instead:
        await Bot.SendTextMessageAsync(e.Query.Message.Chat, reply);
    }

}

Upvotes: 2

Related Questions