Fix return value when fwding msgs if some are missing

It was supposed to return None for the spots were it failed to fwd
a message, but instead only those that were present were returned,
because we were iterating over the wrong object (dict and not list).
This commit is contained in:
Lonami Exo 2020-05-24 18:35:06 +02:00
parent 165950169f
commit 88e7f0da65

View File

@ -211,13 +211,18 @@ class MessageParseMethods:
# deleted or `WORKER_BUSY_TOO_LONG_RETRY` if there are issues at
# Telegram), in which case we get some "missing" message mappings.
# Log them with the hope that we can better work around them.
#
# This also happens when trying to forward messages that can't
# be forwarded because they don't exist (0, service, deleted)
# among others which could be (like deleted or existing).
self._log[__name__].warning(
'Request %s had missing message mappings %s', request, result)
return [
mapping.get(random_to_id.get(rnd))
or opposite.get(random_to_id.get(rnd))
for rnd in random_to_id
(mapping.get(random_to_id[rnd]) or opposite.get(random_to_id[rnd]))
if rnd in random_to_id
else None
for rnd in random_id
]
# endregion