Use the walrus instead of a for loop

master
Dan Elkouby 2020-02-13 17:09:45 +00:00
parent 5c0b30cb15
commit cb28f86038
1 changed files with 1 additions and 4 deletions

View File

@ -25,10 +25,7 @@ async def _(event):
reply = cache.get(message, -1)
if reply == -1:
reply = None
async for m in borg.iter_messages(
event.chat_id,
ids=message
):
if m := await borg.get_messages(event.chat_id, ids=message):
reply = m.reply_to_msg_id
cache[message] = reply
if len(cache) % 10 == 0: