Remove message history limit, add message count report
* When fetching the chat history, we don't use the default limit of 100 and set it to unlimited. * For every 1000 messages recorded in the history, we report that in the debug log. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -123,7 +123,7 @@ class Client(discord.Client):
|
||||
)
|
||||
count = 0
|
||||
skipped = 0
|
||||
async for message in channel.history(after=last_message):
|
||||
async for message in channel.history(after=last_message, limit=None):
|
||||
if message.author.bot:
|
||||
continue
|
||||
if message.content.strip().startswith("!"):
|
||||
@@ -131,6 +131,15 @@ class Client(discord.Client):
|
||||
continue
|
||||
count += 1
|
||||
self.chain.add(guild.id, message.author.id, message.content, commit=False)
|
||||
if count % 1000 == 0:
|
||||
log.debug(
|
||||
"%s (%s) %s (%s) - %s messages",
|
||||
guild.id,
|
||||
guild.name,
|
||||
channel.id,
|
||||
channel.name,
|
||||
count,
|
||||
)
|
||||
self.db.commit()
|
||||
log.info(
|
||||
"Guild %s (%s): channel %s (%s): synchronized %s messages (skipped %s messages that looked like commands)",
|
||||
|
||||
Reference in New Issue
Block a user