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

Fix for Wipe Archive Feature API ERROR 50024 - 50021 #603

Open
wants to merge 2 commits 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
24 changes: 24 additions & 0 deletions src/undiscord-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,30 @@ class UndiscordCore {
await wait(w * 2);
return await this.search();
}
if (resp.status === 400 ) {
const data = await resp.json();
if (data.code === 50024) {
// 400 can happen if the channel is not found (code=50024)
log.error('Error searching messages, channel not found!');
// return fake empty messages data to skip the next channel
const data = { total_results: 0, messages: [] };
this.state._seachResponse = data;
return data;

}

}
if (resp.status === 403) {
const data = await resp.json();
if (data.code === 50001) {
// 403 can happen if the bot is not in the guild (code=50001)
log.error('Error searching messages, user is not in the guild!');
// return fake empty messages data to skip the next channel
const data = { total_results: 0, messages: [] };
this.state._seachResponse = data;
return data;
}
}
else {
this.state.running = false;
log.error(`Error searching messages, API responded with status ${resp.status}!\n`, await resp.json());
Expand Down