mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Fix !clean sometimes cleaning too many messages
This commit is contained in:
parent
9ec93db08c
commit
94756faa5d
1 changed files with 3 additions and 1 deletions
|
@ -618,8 +618,10 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
if (moment.utc(message.posted_at).valueOf() < timeCutoff) return false;
|
||||
return true;
|
||||
});
|
||||
const remaining = args.count - messagesToClean.length;
|
||||
const withoutOverflow = filtered.slice(0, remaining);
|
||||
messagesToClean.push(...withoutOverflow);
|
||||
|
||||
messagesToClean.push(...filtered);
|
||||
beforeId = potentialMessagesToClean[potentialMessagesToClean.length - 1].id;
|
||||
|
||||
if (moment.utc(potentialMessagesToClean[potentialMessagesToClean.length - 1].posted_at).valueOf() < timeCutoff) {
|
||||
|
|
Loading…
Add table
Reference in a new issue