From d60102c0fde329986992079c3b57a974f0da60a1 Mon Sep 17 00:00:00 2001 From: Paillat Date: Thu, 31 Aug 2023 13:55:42 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(makeprompt.py):=20fix=20off-?= =?UTF-8?q?by-one=20error=20in=20limit=20check=20when=20fetching=20message?= =?UTF-8?q?=20history=20=E2=9C=A8=20feat(makeprompt.py):=20include=20the?= =?UTF-8?q?=20original=20message=20in=20the=20fetched=20message=20history?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/makeprompt.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/makeprompt.py b/src/makeprompt.py index f710269..149f34c 100644 --- a/src/makeprompt.py +++ b/src/makeprompt.py @@ -43,8 +43,10 @@ async def fetch_messages_history(channel: discord.TextChannel, limit, original_m async for msg in channel.history(limit=100, before=original_message): if not is_ignorable(msg.content): messages.append(msg) - if len(messages) == limit: + if len(messages) == limit-1: break + + messages.append(original_message) messages.reverse() return messages