diff options
author | Guillermo Ramos | 2020-03-07 13:37:12 +0100 |
---|---|---|
committer | Guillermo Ramos | 2020-03-07 13:37:12 +0100 |
commit | 6f347a1ff480a16a4010ef5b5a044bc55ff2c6f7 (patch) | |
tree | 9cc49ccebcceb5f21b1185b994ce28c56a4b8432 /lib | |
parent | facd913e5418fde9823ea24e476a0b0cd5ef154c (diff) | |
download | tgutils-6f347a1ff480a16a4010ef5b5a044bc55ff2c6f7.tar.gz |
Fix handling of non-message updates
Diffstat (limited to 'lib')
-rw-r--r-- | lib/TgLib/Api.pm | 7 |
1 files changed, 2 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; } } |