aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/TgLib/Api.pm7
-rwxr-xr-xtgserver2
2 files changed, 4 insertions, 5 deletions
diff --git a/lib/TgLib/Api.pm b/lib/TgLib/Api.pm
index 51d4c31..02e8b83 100644
--- a/lib/TgLib/Api.pm
+++ b/lib/TgLib/Api.pm
@@ -37,11 +37,8 @@ sub get_updates {
} else {
my $updates = decode_json($resp->content)->{'result'};
# TODO why does `decode_json` not do this work?
- map { utf8::encode($_->{'message'}{'text'}) if exists $_->{'message'}{'text'} } @$updates;
- $logger->debug(sprintf "Received %d updates from chats %s\n",
- scalar(@$updates),
- join(", ", map { $_->{'message'}{'chat'}{'id'} } @$updates))
- if @$updates;
+ map { utf8::encode($_->{'message'}{'text'}) if exists $_->{'message'} && exists $_->{'message'}{'text'} } @$updates;
+ $logger->debug(sprintf "Received %d updates\n", scalar(@$updates)) if @$updates;
return $updates;
}
}
diff --git a/tgserver b/tgserver
index 55855ce..4de8fdb 100755
--- a/tgserver
+++ b/tgserver
@@ -75,6 +75,8 @@ while (1) {
my $msg = $update->{'edited_message'};
# TODO
$logger->info("Received edited message, ignoring...");
+ } else {
+ $logger->warn("Received unknown update type (ignoring): $update\n");
}
}
}