diff options
author | Mole Shang <[email protected]> | 2023-03-09 00:22:42 +0800 |
---|---|---|
committer | Mole Shang <[email protected]> | 2023-03-09 00:22:42 +0800 |
commit | cd556e004cf27a029bd9cd00b45b48f4965f6a67 (patch) | |
tree | 38c927efcad5e8f9a1ccfb9eca84e5df52fe7fab | |
parent | 783a5f5986434b64fe93b6f1a54c6b16ce6b0a31 (diff) | |
download | telegram-mail-bot-cd556e004cf27a029bd9cd00b45b48f4965f6a67.tar.gz telegram-mail-bot-cd556e004cf27a029bd9cd00b45b48f4965f6a67.tar.bz2 telegram-mail-bot-cd556e004cf27a029bd9cd00b45b48f4965f6a67.zip |
fix(bot.py): fix for range iteration to prevent duplication of last email in inbox
The start value in range() should be inbox_num + 1.
Ref: https://github.com/hyfc/telegram-mail-bot/commit/d741c552a7dbe18515955bfc2c173367a03fdbc7#r103400598
-rw-r--r-- | bot.py | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -87,7 +87,7 @@ async def periodic_task(context: CallbackContext) -> None: with EmailClient(email_addr, email_passwd) as client: new_inbox_num = client.get_mails_count() if new_inbox_num > inbox_num: - for i in range(inbox_num, new_inbox_num + 1): + for i in range(inbox_num + 1, new_inbox_num + 1): mail = client.get_mail_by_index(i) content = mail.__repr__() for text in handle_large_text(content): |