use C# telegram.bot - get BotOnCallbackQueryReceived result in webhook (.net core)
pramirhossein opened this issue · 1 comments
pramirhossein commented
Hello !
I can not implement the event OnCallbackQuery or OnMessage in telegram.bot webhook ! ( .net core )
public async Task EchoAsync(Update update)
{
Message message = update.Message;
_botService.Client.OnMessage += BotOnMessageReceived;
_botService.Client.OnCallbackQuery += BotOnCallbackQueryReceived;
}
private async void BotOnCallbackQueryReceived(object sender, CallbackQueryEventArgs callbackQueryEventArgs)
{
Telegram.Bot.Types.CallbackQuery callbackQuery =
callbackQueryEventArgs.CallbackQuery;
await _botService.Client.AnswerCallbackQueryAsync(
callbackQuery.Id,
$"Received {callbackQuery.Data}");
}
This method works in ConsoleApplication C# but , does not work in webhook mode
karb0f0s commented
If you're working with .NET Core 3+ you have to add JsonNet to deserialize Update
object properly.