minor fix "start from message id"
This commit is contained in:
parent
cae47b697c
commit
f5cdf1b1ff
2 changed files with 4 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
BackupReader — discord.py-compatible local data provider.
|
||||
|
||||
Reads from local backup JSON files (produced by DiscordExporter) instead of the
|
||||
Reads from local backup JSON files (produced by Reaper) instead of the
|
||||
Discord API. Implements the same public interface as DiscordReader so that
|
||||
migration scripts and UI code can use either provider transparently.
|
||||
"""
|
||||
|
|
@ -964,7 +964,7 @@ class BackupReader:
|
|||
|
||||
for m in messages:
|
||||
msg_id = int(m["messageID"])
|
||||
if after_id and msg_id <= after_id:
|
||||
if after_id and msg_id < after_id:
|
||||
continue
|
||||
|
||||
yield self._hydrate_message(m, channel_id)
|
||||
|
|
|
|||
|
|
@ -217,7 +217,8 @@ class DiscordReader:
|
|||
"""Yields messages from a given channel, optionally handling pagination."""
|
||||
channel = await self.get_channel(channel_id)
|
||||
if isinstance(channel, discord.TextChannel) or isinstance(channel, discord.Thread):
|
||||
after = discord.Object(id=after_id) if after_id else None
|
||||
# Discord's 'after' is exclusive. To make it inclusive, we use after_id - 1.
|
||||
after = discord.Object(id=after_id - 1) if after_id else None
|
||||
logger.info(f"Fetching message history for {channel.name} ({channel.id}) oldest_first=True after={after_id}")
|
||||
# To avoid exploding RAM, we yield items one by one
|
||||
async for message in channel.history(limit=limit, oldest_first=True, after=after):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue