From 2d2ec55f03af01e77a0d0835d4103eea5b356da9 Mon Sep 17 00:00:00 2001 From: Rodger Castle Date: Thu, 4 Jun 2026 22:23:27 -0400 Subject: [PATCH] check callback_query first --- lib/Mnemosyne/Webhook.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Mnemosyne/Webhook.pm b/lib/Mnemosyne/Webhook.pm index f2e7767..a48fad1 100644 --- a/lib/Mnemosyne/Webhook.pm +++ b/lib/Mnemosyne/Webhook.pm @@ -34,8 +34,11 @@ sub handle_update { warn "DBG full_update: " . encode_json($update) . "\n"; - my $upd_type = exists $update->{message} ? 'message' - : exists $update->{callback_query} ? 'callback_query' + # callback_query is checked first: Telegram occasionally sends a stub + # top-level "message" key alongside callback_query updates, so existence + # of "message" alone is not a reliable discriminator. + my $upd_type = exists $update->{callback_query} ? 'callback_query' + : exists $update->{message} ? 'message' : 'unknown'; warn "DBG update type=$upd_type chat=$chat_id\n";