3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-18 15:45:03 +00:00

ChannelArchiver: break out of the loop if there are no more messages to archive

This commit is contained in:
Dragory 2019-08-10 00:28:18 +03:00
parent 72dc016cc3
commit e75b87e8d5

View file

@ -99,6 +99,7 @@ export class ChannelArchiverPlugin extends ZeppelinPlugin {
while (archivedMessages < maxMessagesToArchive) {
const messagesToFetch = Math.min(MAX_MESSAGES_PER_FETCH, maxMessagesToArchive - archivedMessages);
const messages = await args.channel.getMessages(messagesToFetch, previousId);
if (messages.length === 0) break;
for (const message of messages) {
const ts = moment.utc(message.timestamp).format("YYYY-MM-DD HH:mm:ss");