aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2023-01-25 15:56:12 +0800
committerMole Shang <[email protected]>2023-01-25 15:56:12 +0800
commitb6d4781af03497c19442cc2081790793bbe25e87 (patch)
tree3bee1850ddbf4654cb90d85c1d30140722f09a3f
parentbe447d0ea7fc30b7bd7bdfe730532f20a3f00b77 (diff)
downloadtelegram-mail-bot-b6d4781af03497c19442cc2081790793bbe25e87.tar.gz
telegram-mail-bot-b6d4781af03497c19442cc2081790793bbe25e87.tar.bz2
telegram-mail-bot-b6d4781af03497c19442cc2081790793bbe25e87.zip
fix(box.py): correct range logic when receiving more than one emails
-rw-r--r--bot.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/bot.py b/bot.py
index 11fc201..877b461 100644
--- a/bot.py
+++ b/bot.py
@@ -90,8 +90,8 @@ 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, inbox_num + new_inbox_num):
- mail = client.get_mail_by_index(i + 1)
+ for i in range(inbox_num, new_inbox_num + 1):
+ mail = client.get_mail_by_index(i)
content = mail.__repr__()
for text in handle_large_text(content):
await context.bot.send_message(context.job.chat_id, text=text)