diff --git a/lib/Mnemosyne/Webhook.pm b/lib/Mnemosyne/Webhook.pm index a48fad1..6379c9a 100644 --- a/lib/Mnemosyne/Webhook.pm +++ b/lib/Mnemosyne/Webhook.pm @@ -42,10 +42,10 @@ sub handle_update { : 'unknown'; warn "DBG update type=$upd_type chat=$chat_id\n"; - if (my $msg = $update->{message}) { - _handle_message($msg, $chat_id, $db, $config, $telegram); - } elsif (my $cbq = $update->{callback_query}) { - _handle_callback($cbq, $chat_id, $db, $config, $telegram); + if ($upd_type eq 'callback_query') { + _handle_callback($update->{callback_query}, $chat_id, $db, $config, $telegram); + } elsif ($upd_type eq 'message') { + _handle_message($update->{message}, $chat_id, $db, $config, $telegram); } }