3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +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 64f7b8cce4
commit cd07a3e32e

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");