From 53d6807e8d2839b518ee4a82129edce400a26dc8 Mon Sep 17 00:00:00 2001 From: link2xt Date: Wed, 30 Nov 2022 22:45:03 +0000 Subject: [PATCH] Simplify process_messages() in echo bot --- deltachat-rpc-client/examples/echobot.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/deltachat-rpc-client/examples/echobot.py b/deltachat-rpc-client/examples/echobot.py index 6c31d5d4d..d5b95f3a2 100755 --- a/deltachat-rpc-client/examples/echobot.py +++ b/deltachat-rpc-client/examples/echobot.py @@ -27,12 +27,8 @@ async def main(): await deltachat.start_io() async def process_messages(): - fresh_messages = await account.get_fresh_messages() - fresh_message_snapshot_tasks = [ - message.get_snapshot() for message in fresh_messages - ] - fresh_message_snapshots = await asyncio.gather(*fresh_message_snapshot_tasks) - for snapshot in fresh_message_snapshots: + for message in await account.get_fresh_messages_in_arrival_order(): + snapshot = await message.get_snapshot() if not snapshot.is_info: await snapshot.chat.send_text(snapshot.text) await snapshot.message.mark_seen()