Git Product home page Git Product logo

victornpb / undiscord Goto Github PK

View Code? Open in Web Editor NEW
5.1K 44.0 715.0 1.07 MB

Undiscord - Delete all messages in a Discord server / channel or DM (Easy and fast) Bulk delete

Home Page: https://victornpb.github.io/undiscord

License: MIT License

JavaScript 81.88% CSS 8.72% HTML 9.40%
discord delete-multiple bulk-operation discord-channel discordapp userscript browser-extension greasemonkey greasymonkey-userscript tampermonkey

undiscord's Issues

Skips some messages

Every once in a while, there will be a few stray messages that are not deleted. (This is not a graphical issue, because after reloading they still exist.) - Running the script again seems to work for removing them.

Script tries to delete system messages

If you run the script in a direct chat group, this script tries to delete system message which contents are "Perflyst added xxx to the group."
Error deleting message, API responded with status 403! {"message":"Cannot execute action on a system message","code":50021} Related object: {"hit":true,"attachments":[],"tts":false,"embeds":[],"timestamp":"201xxxxxx","mention_everyone":false,"id":"xx","pinned":false,"edited_timestamp":null,"author":{"username":"Perflyst","discriminator":"xx","id":"xx","avatar":"xxxx"},"mention_roles":[],"content":"","channel_id":"xx","mentions":[{"username":"User2","discriminator":"xx","id":"xx","avatar":"xx"}],"type":1}

No "do you want to delete" popup.

there's no popup for confirming you want to delete the messages when it has to index a channel/dm. It just jumps straight to deleteing messages after the 2sec wait.

This channel wasn't indexed, waiting 2000ms for discord to index it...

(I've only been able to test this in dms btw)

Can not run script?

Hello,
Was wondering if I could get a little help with an error message i'm receiving when attempting to run this script. I posted an image below. Any help is greatly appreciated.

image

Donation?

I used your deleteDiscordMessages. It's extremely, EXTREMELY useful. I've managed to purge tens of thousands of messages. Do you have a donation anywhere? I'll glad donate you $5 USD.

Doesn't seem to work anymore (DM received, not my messages)

Hi,
so after i successfully deleted all my messages by hand, I used your .js to delete my correspondent's messages.

but I got this error:

{"message":"Cannot execute action on a DM channel","code":50003}

Also minor thing but the counter always increment:

295.92% (145/49) Deleting ID:REDACTED REDACTED (REDACTED): REDACTED

Anyway thank you for sharing this

[BUG] Delete delay wrongly calculated

WARNING: Github Issues are publicly visible, do not post sensitive information here.
You may want to check "Hide sensitive information" before taking screenshots or copying logs.

Describe the bug

When being rate limited, the script will increase delete delay, but, way too much.

To Reproduce
Steps to reproduce the behavior:

  1. Auto-get your token, guild ID and channel
  2. Paste someone's ID
  3. Click "start"

Screenshots / Logs

  • The first 30 messages will be successfully deleted using a 100ms delay.
Total messages found: 182	(Messages in current page: 25, Author: 25, System: 0)	offset: 0
Delete delay: 100ms, Search delay: 100ms	Last Ping: 592ms, Average Ping: 592ms
Estimated time remaining: 0h 2m 6s
Waiting for your confirmation...
OK
0.55% (1/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
1.10% (2/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
1.65% (3/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
2.20% (4/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	REDACTED
2.75% (5/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
3.30% (6/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
3.85% (7/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
4.40% (8/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
4.95% (9/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
5.49% (10/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
6.04% (11/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
6.59% (12/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
7.14% (13/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
7.69% (14/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	REDACTED
8.24% (15/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
8.79% (16/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
9.34% (17/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
9.89% (18/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
10.44% (19/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
10.99% (20/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
11.54% (21/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
12.09% (22/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
12.64% (23/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
13.19% (24/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	REDACTED
13.74% (25/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
Searching next messages in 100ms...	
Total messages found: 158	(Messages in current page: 24, Author: 24, System: 0)	offset: 0
Delete delay: 100ms, Search delay: 100ms	Last Ping: 440ms, Average Ping: 242ms
Estimated time remaining: 0h 0m 54s
14.29% (26/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
14.84% (27/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
15.38% (28/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
15.93% (29/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
16.48% (30/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
Being rate limited by the API for 63138ms! Adjusted delete delay to 63238ms.
Delete delay: 63238ms, Search delay: 100ms	Last Ping: 160ms, Average Ping: 244ms
Cooling down for 126276ms before retrying...
  • Now the script will delay every deletion by ~ 2 min
21.98% (40/182)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
Searching next messages in 100ms...	
Total messages found: 143	(Messages in current page: 25, Author: 25, System: 0)	offset: 0
Delete delay: 109525ms, Search delay: 100ms	Last Ping: 429ms, Average Ping: 220ms
Estimated time remaining: 4h 21m 34s
  • The operation which was supposed to take 2 mins will now require more than 4 hours.
    But, here's the thing : if I manually stop the operation and restart it, I can actually delete 30 messages every 2 mins, instead of just one message.

Affects (Add an X to items that apply)

  • DMs
  • DM Groups
  • Channel
  • Channel (NSFW)
  • Server (All Channels)
  • Other (explain)

System:

  • OS: BunsenLabs GNU/Linux 9.8 (Debian-based)
  • Browser: Brave 0.62.51

[BUG] NetworkError when attempting to fetch resource

Describe the bug
Delete request throwed an error: {"fileName":"","lineNumber":0,"columnNumber":0,"message":"NetworkError when attempting to fetch resource."}

To Reproduce
Steps to reproduce the behavior:

  1. F12
  2. Paste
  3. Enter information with the buttons
  4. Press start
  5. Script stops because of error

Screenshots / Logs
If applicable, add screenshots and or copy log to help explain your problem.

Delete request throwed an error:	{"fileName":"","lineNumber":0,"columnNumber":0,"message":"NetworkError when attempting to fetch resource."}

Affects

  • DMs
  • DM Groups
  • Channel
  • Channel (NSFW)
  • Server (All Channels)

System:

  • OS: Windows 10
  • Browser: Crome, Firefox

EDIT: NEVER MIND! Just replace all discordapp.com urls with discord.com! FIXED!

error 403 code 50001

Script working properly in DMs with people, but not working in a server where I am a mod and have all privileges, including "Manage Messages"

I am only trying to delete my own messages as well, so I'm not sure what could be giving this error.
image

Missing Access

Using the latest version from the repo I get this error when attempting to delete:

Started at 03/12/2019, 11:54:16
authorId="my id" guildId="guild id" channelId="channel id" afterMessageId="" beforeMessageId="" hasLink=false hasFile=false
Error searching messages, API responded with status 403!
	{"message":"Missing Access","code":50001}

Using Chrome for this.

403 Issue!

I can easily delete my own messages, but cannot delete other users messages on DM. Havin issue like this.

image

404 Error

When attempting to use the code, the following occurs:

Started at 12/7/2019, 11:53:50 PM
authorId="##################" guildId="@me" channelId="##################" afterMessageId="" beforeMessageId="" hasLink=false hasFile=false
Error searching messages, API responded with status 404!
{"message":"404: Not Found","code":0}

Delete all messages from a guild returns a 404.

Total messages found: 4841	(Messages in current page: 25, Author: 25, System: 0)	offset: 0
Delete delay: 100ms, Search delay: 100ms	Last Ping: 1100ms, Average Ping: 1100ms
Estimated time remaining: 1h 37m 8s
Waiting for your confirmation...
OK
0.02% (1/4841)	Deleting ID:{id} {username} (1/17/2020, 1:11:20 PM\): {message}
Error deleting message, API responded with status 404!	{"message":"404: Not Found","code":0}
Related object:	{"id":"{id}","type":0,"content":"lol where did you get it?","channel_id":"358933713549262857","author":{"id":"516704923996651540","username":".Ras","avatar":"e2aa0383ad1293e516a85cabd08a0a89","discriminator":"5894"},"attachments":[],"embeds":[],"mentions":[],"mention_roles":[],"pinned":false,"mention_everyone":false,"tts":false,"timestamp":"2020-01-17T13:11:20.815000+00:00","edited_timestamp":null,"flags":0,"hit":true}
0.04% (2/4841)	Deleting ID:{id} {username} (1/17/2020, 1:05:59 PM\): {message}
Error deleting message, API responded with status 404!	{"message":"404: Not Found","code":0}
...

httpcat404

[Enhancement] Handy bookmarklet

Just an idea: Making a handy bookmarklet for it?
Tried to minify the code and paste it like javascript:(function(){... as bookmarklet.
PopUp opens fine. This line however makes the whole page go blank/white with the text "Looking good!". Removing the line seems to work. getting the AuthToken, AuthorID and ChannelID appears to work as well, but deleting does't. I guess the bookmarklet doesn't have access to the same context in which devtools is running, but haven't had time to debug in depth

A wipe account option

an option that wipes all messages, leaves/deletes all servers and unfriends all friends however a filter would be nice so you can keep certain servers or friends

The script isn't working anymore.

I did use multiple revisions of this script in past and everything worked great however after trying to remove all my messages in one of the DM conversation I get an error:


Do you want to delete ~1 messages?
Estimated time: 0h 0m 0s

---- Preview ----
Myusername#1234:

I get this error in both Firefox and Chrome. They are both latest version. The script log after error:

Started at 2/3/2020, 9:05:43 PM
authorId="123456" guildId="@me" channelId="123456" afterMessageId="" beforeMessageId="" hasLink=false hasFile=false
Total messages found: 1	(Messages in current page: 1, Author: 0, System: 1)	offset: 0
Delete delay: 100ms, Search delay: 100ms	Last Ping: 327ms, Average Ping: 327ms
Estimated time remaining: 0h 0m 0s
Waiting for your confirmation...
Aborted by you!
Ended at 2/3/2020, 9:06:38 PM! Total time: 0h 0m 54s
Delete delay: 100ms, Search delay: 100ms	Last Ping: 327ms, Average Ping: 327ms
Rate Limited: 0 times. Total time throttled: 0h 0m 0s.
Deleted 0 messages, 0 failed.

Suggestion: option to delete only files or links

Hello,

First of all - thank you for creating this!

I had a couple suggestions. Don't know if they are possible, but if they are I think they would be useful.

Option to delete just attachments/files/images.
Option to delete just links.
Reason: Users have tens (and sometimes hundreds) of thousands of messages in separate servers & conversations, which takes a lot of time to delete (on top of the occasional errors occur and if user isn't present to restart the process it takes even longer).
Images, files, links (which could be images shared on other websites and posted on discord via link instead of directly, links to social media or accounts on various websites, e-mail addresses) often contain most sensitive personal information. Therefore it would be useful to delete these first instead of going through all of the messages.

When deleting messages it always jumps to top (first messages deleted) and you have to manually scroll down (and hold it) to see the progress/current messages being deleted. Would be convenient if either it didn't jump to top or current messages would be added on top instead of bottom.

No pop-up

it allows me to paste the script but when I click enter here is no popup, just motif that Microsoft needs an app to read it, hen says Microsoft does not have apps to recommend. So I cant proceed. recomendations?

You're awesome

Okay FINE, not an issue. I just wanted to say thanks. Had to nuke a #channel and this was the first script that I was able to understand (good for learning so thanks :) ) while reading through, and the UI was πŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘Œ perfect.

So, uh, yeah. Thanks! ^_^

Won't execute

After hitting Start I get this error in console

VM81:171 Uncaught (in promise) TypeError: Cannot read property 'type' of undefined
at :171:65
at Array.filter ()
at recurse (:171:47)
at async deleteMessages (:249:16)

Weird performance after cooldown from the ratelimit

So when I hit the rate limit when deleting around 31 messages, the script doubles the delete delay timer to cool down. That's fine. But when we chilled a bit, and the time is up, the deleting process became very very slow.

My current approach is that delete 31 messages, stop it. Then wait 30 seconds or more, and restart the deletion. This way is much more a hassle, but more quicker compare to those slow snail-like deletion after chilled down from the rate limit.

Is there any chance to fix this issue?

[BUG] Not Deleting All Messages

Describe the bug
When running deleter on a channel, it deletes most of the messages, I then ran through all messages on each channel of the group, but if I do a from:username, stuff that I pinned (the actual pin message, not the content I pinned) shows up, and also a few random messages still never got deleted (just messages, emotes, etc.) which should've. Not sure why. It seems to be detecting all my messages, I ran it in one chat, and ran through like 8k+ messages no errors. I ran it over again and it said nothing to delete, but it seems like there is.

System:

  • OS: Win10
  • Browser: Firefox ESR

Error when attempting delete

When attempting to delete, using the code, I get the following response

Error searching messages, API responded with status 404!
{"message":"404: Not Found","code":0}

Not sure what the issue is, followed the readme

Deletion stops after 26 messages in DM

Hi! First of all, thanks for all your effort of coding this thing!
For some reason though, every time I try to delete the messages in DM it stops after 26 messages:

0.12% (26/22548) Deleting ID:641395138689630220 User#9999 (5-11-2019 22:55:17): Wat?
Searching next messages in 100ms...
Total messages found: 22548 (Messages in current page: 0, Author: 0, System: 0) offset: 0
Delete delay: 365ms, Search delay: 100ms Last Ping: 253ms, Average Ping: 198ms
Estimated time remaining: 3h 33m 18s
Ended because API returned an empty page.
Ended at 20-11-2019 13:58:47! Total time: 0h 0m 18s
Delete delay: 365ms, Search delay: 100ms Last Ping: 253ms, Average Ping: 198ms
Rate Limited: 1 times. Total time throttled: 0h 0m 0s.
Deleted 26 messages, 0 failed.

Am I doing something wrong here? Using Chrome.

Delete reactions on others messages

Is your feature request related to a problem? Please describe.
If someone wants to remove / clean his discord history and account he probably also wants to get rid of his reactions

Describe the solution you'd like
The script should also remove reactions on other peoples messages

Suggestion: allow to queue deletion

Also, add a way to skip the current one (in case of infinite loop glitch) and to restart current or go back one (because sometimes it skips messages)

[Request] Delete messages with mentions

Hey, you did an amazing job and as a moderator I appreciate the ability to nuke certain users but I'd like to have a smalll request.
Is is possible to delete a message that contains a mention of a certain user? Typing "@Nickname" in the filter doesn't work.

Error: Missing Access Code

Hey,

Whenever I run the script on a channel it returns with this: {"message":"Missing Access","code":50001}
It works fine on dms

{"message":"401: Unauthorized","code":0}

Hello,

so I tried pretty much everything but I still come up with :

Started at 16/12/2019, 06:48:17
authorId="--" guildId="@me" channelId="--" afterMessageId="" beforeMessageId="--" hasLink=false hasFile=false
Error searching messages, API responded with status 401!
{"message":"401: Unauthorized","code":0}

I also had your old version of the code, but I switched it too to be sure, any idea where it comes from ?
Search from discord works again as well

Thank you

Detected 770 messages but deleted 0 message

주석 2019-11-22 003947

I am trying to delete messages about 20 months ago(2018.02). When I press 'Start' button, result says there are 770 messages but deletes 0 message. I scrolled to that message and tried again. Same thing happened.

In this case, I didn't set 'Range' option. But When I set 'Range' option starting from very first message I've sent to last message I've sent, It stops to delete message at 26th deletion, so #23 might be related to.

Started at 2019. 11. 22. μ˜€μ „ 12:44:29
authorId="REDACTED" channelId="REDACTED" afterMessageId="REDACTED" beforeMessageId="REDACTED" hasLink=false hasFile=false
Total messages found: 704	(Messages in current page: 25, Author: 25, System: 0)	offset: 0
Delete delay: 100ms, Search delay: 100ms	Last Ping: 681ms, Average Ping: 681ms
Estimated time remaining: 0h 9m 12s
Waiting for your confirmation...
OK
0.14% (1/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
0.28% (2/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
0.43% (3/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
0.57% (4/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
0.71% (5/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
0.85% (6/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
0.99% (7/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
1.14% (8/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
1.28% (9/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
1.42% (10/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
1.56% (11/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
1.70% (12/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
1.85% (13/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
1.99% (14/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
2.13% (15/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
2.27% (16/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
2.41% (17/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
2.56% (18/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
2.70% (19/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
2.84% (20/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
2.98% (21/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
3.13% (22/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
3.27% (23/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
3.41% (24/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
3.55% (25/704)	Deleting ID:REDACTED REDACTED (REDACTED): REDACTED	
Searching next messages in 100ms...	
Total messages found: 704	(Messages in current page: 0, Author: 0, System: 0)	offset: 0
Delete delay: 100ms, Search delay: 100ms	Last Ping: 301ms, Average Ping: 277ms
Estimated time remaining: 0h 4m 28s
Ended because API returned an empty page.
Ended at 2019. 11. 22. μ˜€μ „ 12:44:40! Total time: 0h 0m 10s
Delete delay: 100ms, Search delay: 100ms	Last Ping: 301ms, Average Ping: 277ms
Rate Limited: 0 times. Total time throttled: 0h 0m 0s.
Deleted 25 messages, 0 failed.

Request - nuclear option

Possible to add a nuclear option? Delete from everywhere: all servers, all channels, all dms.

Possibly with an exclude list in case you want to leave one server/chat/dm untouched for example.

[Request] Delete messages with specified word

Hello. I would like to thank author for this script, it's very useful and works well. I just have one problem.
My messages in a certain DM have over 100k messages so of course it will take very long to delete them all, so it is not ideal for me when I just really want to delete hundreds messages containing a certain word. E.g. I want it to look for my all messages in a DM that contain "foo" and delete them all. Is this possible at all? I understand what I am requesting for might be a lot of work or even impossible so I understand if it isn't doable. :) Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.