Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop attempting to delete CHAT_INPUT_COMMAND (Type 20) messages + Adjust delete delay after ratelimit to compensate ontop of current delay #527

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/undiscord-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class UndiscordCore {

this.stats.throttledCount++;
this.stats.throttledTotalTime += w;
this.stats.searchDelay += w; // increase delay
this.stats.searchDelay += this.stats.searchDelay + w; // increase delay
w = this.stats.searchDelay;
log.warn(`Being rate limited by the API for ${w}ms! Increasing search delay...`);
this.printStats();
Expand Down Expand Up @@ -309,7 +309,7 @@ class UndiscordCore {

// we can only delete some types of messages, system messages are not deletable.
let messagesToDelete = discoveredMessages;
messagesToDelete = messagesToDelete.filter(msg => msg.type === 0 || (msg.type >= 6 && msg.type <= 21));
messagesToDelete = messagesToDelete.filter(msg => msg.type === 0 || (msg.type >= 6 && msg.type <= 19) || msg.type === 21);
messagesToDelete = messagesToDelete.filter(msg => msg.pinned ? this.options.includePinned : true);

// custom filter of messages
Expand Down