From cb28f8603806473a7c2b5ffebdea5adcfddd6c3d Mon Sep 17 00:00:00 2001 From: Dan Elkouby Date: Thu, 13 Feb 2020 17:09:45 +0000 Subject: [PATCH] Use the walrus instead of a for loop --- stdplugins/chain.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/stdplugins/chain.py b/stdplugins/chain.py index f35bfff..6119920 100644 --- a/stdplugins/chain.py +++ b/stdplugins/chain.py @@ -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: