Removed debugging notices

This commit is contained in:
Rodger Castle 2026-06-04 22:34:37 -04:00
parent b4726d44ec
commit f8bf790449
3 changed files with 3 additions and 19 deletions

View File

@ -205,14 +205,6 @@ sub _post {
my $url = API_BASE . $self->{_token} . '/' . $method; my $url = API_BASE . $self->{_token} . '/' . $method;
my $json = encode_json($body); my $json = encode_json($body);
if ($method =~ /^(sendMessage|editMessageText)$/) {
my $kb = !exists $body->{reply_markup} ? 'none'
: exists $body->{reply_markup}{inline_keyboard} ? 'inline'
: exists $body->{reply_markup}{keyboard} ? 'reply'
: 'other';
warn "DBG _post $method: keyboard_type=$kb\n";
}
my $tx = $self->{_ua}->post( my $tx = $self->{_ua}->post(
$url => { 'Content-Type' => 'application/json' } => $json $url => { 'Content-Type' => 'application/json' } => $json
); );

View File

@ -3,7 +3,6 @@ use strict;
use warnings; use warnings;
use utf8; use utf8;
use DateTime; use DateTime;
use Mojo::JSON qw(encode_json);
use Mnemosyne::Task; use Mnemosyne::Task;
use Mnemosyne::Digest; use Mnemosyne::Digest;
use Mnemosyne::Schedule; use Mnemosyne::Schedule;
@ -32,16 +31,12 @@ sub handle_update {
return; return;
} }
warn "DBG full_update: " . encode_json($update) . "\n";
# callback_query is checked first: Telegram occasionally sends a stub # callback_query is checked first: Telegram occasionally sends a stub
# top-level "message" key alongside callback_query updates, so existence # top-level "message" key alongside callback_query updates, so existence
# of "message" alone is not a reliable discriminator. # of "message" alone is not a reliable discriminator.
my $upd_type = exists $update->{callback_query} ? 'callback_query' my $upd_type = exists $update->{callback_query} ? 'callback_query'
: exists $update->{message} ? 'message' : exists $update->{message} ? 'message'
: 'unknown'; : 'unknown';
warn "DBG update type=$upd_type chat=$chat_id\n";
if ($upd_type eq 'callback_query') { if ($upd_type eq 'callback_query') {
_handle_callback($update->{callback_query}, $chat_id, $db, $config, $telegram); _handle_callback($update->{callback_query}, $chat_id, $db, $config, $telegram);
} elsif ($upd_type eq 'message') { } elsif ($upd_type eq 'message') {
@ -65,7 +60,6 @@ sub _handle_message {
# Wizard in progress — /cancel always escapes; other commands are blocked # Wizard in progress — /cancel always escapes; other commands are blocked
if (exists $SESSIONS{$chat_id} && $SESSIONS{$chat_id}{step} ne 'done') { if (exists $SESSIONS{$chat_id} && $SESSIONS{$chat_id}{step} ne 'done') {
warn "DBG handle_message_in_session: step=$SESSIONS{$chat_id}{step} text=" . substr($text, 0, 60) . "\n";
if ($text =~ /^\/cancel/i) { if ($text =~ /^\/cancel/i) {
_cmd_cancel($chat_id, $telegram); _cmd_cancel($chat_id, $telegram);
} elsif ($text =~ /^\//) { } elsif ($text =~ /^\//) {
@ -100,7 +94,6 @@ sub _handle_callback {
my ($cbq, $chat_id, $db, $config, $telegram) = @_; my ($cbq, $chat_id, $db, $config, $telegram) = @_;
my $data = $cbq->{data} // ''; my $data = $cbq->{data} // '';
my $cbq_id = $cbq->{id}; my $cbq_id = $cbq->{id};
warn "DBG handle_callback: data=$data\n";
my $msg = $cbq->{message} // {}; my $msg = $cbq->{message} // {};
my $msg_id = $msg->{message_id}; my $msg_id = $msg->{message_id};
@ -455,7 +448,6 @@ sub _wizard_text {
sub _wizard_callback { sub _wizard_callback {
my ($data, $cbq_id, $chat_id, $msg_id, $db, $config, $telegram) = @_; my ($data, $cbq_id, $chat_id, $msg_id, $db, $config, $telegram) = @_;
my $sess = $SESSIONS{$chat_id}; my $sess = $SESSIONS{$chat_id};
warn "DBG wizard_callback: data=$data sess=" . ($sess ? $sess->{step} : 'NONE') . "\n";
# If no session but wizard callback arrives, ignore gracefully # If no session but wizard callback arrives, ignore gracefully
unless ($sess) { unless ($sess) {

View File

@ -3,6 +3,9 @@ Description=Mnemosyne Telegram bot (webhook receiver)
Documentation=https://git.castlehollow.com/rodger/mnemosyne Documentation=https://git.castlehollow.com/rodger/mnemosyne
After=network-online.target After=network-online.target
Wants=network-online.target Wants=network-online.target
# Cap restart rate: no more than 5 restarts in 60 seconds
StartLimitBurst=5
StartLimitIntervalSec=60
[Service] [Service]
Type=simple Type=simple
@ -15,9 +18,6 @@ ExecStart=/usr/bin/perl /opt/mnemosyne/bin/mnemosyne-bot \
Restart=always Restart=always
RestartSec=5 RestartSec=5
# Cap restart rate: no more than 5 restarts in 60 seconds
StartLimitBurst=5
StartLimitIntervalSec=60
# Logging # Logging
StandardOutput=journal StandardOutput=journal