From 2f0bc1044172d7f9f410a15fb650fae34522da9d Mon Sep 17 00:00:00 2001
From: falsefox <154926234+false-fox@users.noreply.github.com>
Date: Tue, 21 May 2024 09:44:43 -0700
Subject: [PATCH 1/8] Fix 403
---
src/undiscord-core.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/undiscord-core.js b/src/undiscord-core.js
index 955467f2..af8fff71 100644
--- a/src/undiscord-core.js
+++ b/src/undiscord-core.js
@@ -311,7 +311,10 @@ class UndiscordCore {
let messagesToDelete = discoveredMessages;
messagesToDelete = messagesToDelete.filter(msg => msg.type === 0 || (msg.type >= 6 && msg.type <= 21));
messagesToDelete = messagesToDelete.filter(msg => msg.pinned ? this.options.includePinned : true);
-
+
+ // if the user provided an author.Id, skip all messages that aren't created by the author.Id.
+ // fixes issues with bots & applications hanging the deletion.
+ if (this.options.authorId) messagesToDelete = messagesToDelete.filter(msg => msg.author.id === this.options.authorId);
// custom filter of messages
try {
const regex = new RegExp(this.options.pattern, 'i');
From 98ac2a8a75196274a4def369c1292bc6d746930c Mon Sep 17 00:00:00 2001
From: falsefox <154926234+false-fox@users.noreply.github.com>
Date: Tue, 21 May 2024 09:49:12 -0700
Subject: [PATCH 2/8] Update undiscord-core.js
---
src/undiscord-core.js | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/undiscord-core.js b/src/undiscord-core.js
index af8fff71..cd5fbfa4 100644
--- a/src/undiscord-core.js
+++ b/src/undiscord-core.js
@@ -31,6 +31,7 @@ class UndiscordCore {
includePinned: null, // Delete messages that are pinned
pattern: null, // Only delete messages that match the regex (insensitive)
searchDelay: null, // Delay each time we fetch for more messages
+ includeApplications: null,
deleteDelay: null, // Delay between each delete operation
maxAttempt: 2, // Attempts to delete a single message if it fails
askForConfirmation: true,
@@ -312,10 +313,12 @@ class UndiscordCore {
messagesToDelete = messagesToDelete.filter(msg => msg.type === 0 || (msg.type >= 6 && msg.type <= 21));
messagesToDelete = messagesToDelete.filter(msg => msg.pinned ? this.options.includePinned : true);
- // if the user provided an author.Id, skip all messages that aren't created by the author.Id.
+ // if the user provided an author.Id and doesn't wish to include applications, skip all messages that aren't created by the author.Id.
// fixes issues with bots & applications hanging the deletion.
- if (this.options.authorId) messagesToDelete = messagesToDelete.filter(msg => msg.author.id === this.options.authorId);
- // custom filter of messages
+ if (!this.options.includeApplications) {
+ if (this.options.authorId) messagesToDelete = messagesToDelete.filter(msg => msg.author.id === this.options.authorId);
+ }
+ // custom filter of messages
try {
const regex = new RegExp(this.options.pattern, 'i');
messagesToDelete = messagesToDelete.filter(msg => regex.test(msg.content));
From 23cc4550ca4b19aa0f1049aef0d058a32c4b7adf Mon Sep 17 00:00:00 2001
From: falsefox <154926234+false-fox@users.noreply.github.com>
Date: Tue, 21 May 2024 09:50:20 -0700
Subject: [PATCH 3/8] Update undiscord.html
---
src/ui/undiscord.html | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/ui/undiscord.html b/src/ui/undiscord.html
index 455d9e70..9dc4deb5 100644
--- a/src/ui/undiscord.html
+++ b/src/ui/undiscord.html
@@ -103,6 +103,9 @@
Undiscord
+
+
+