Use the walrus instead of a for loop
parent
5c0b30cb15
commit
cb28f86038
|
@ -25,10 +25,7 @@ async def _(event):
|
||||||
reply = cache.get(message, -1)
|
reply = cache.get(message, -1)
|
||||||
if reply == -1:
|
if reply == -1:
|
||||||
reply = None
|
reply = None
|
||||||
async for m in borg.iter_messages(
|
if m := await borg.get_messages(event.chat_id, ids=message):
|
||||||
event.chat_id,
|
|
||||||
ids=message
|
|
||||||
):
|
|
||||||
reply = m.reply_to_msg_id
|
reply = m.reply_to_msg_id
|
||||||
cache[message] = reply
|
cache[message] = reply
|
||||||
if len(cache) % 10 == 0:
|
if len(cache) % 10 == 0:
|
||||||
|
|
Reference in New Issue