Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Delete all your messages from DM or Channel in Discord

Delete all messages in a Discord channel or DM


This gist moved to https://github.com/victornpb/deleteDiscordMessages


  1. Open Discord in a browser like Chrome or Firefox;

  2. Open DevTools pressing F12 or ⌘ command+option+J;

  3. Copy the deleteDiscordMessages.js script and paste it in the Console, then press ENTER;

  4. A window will be opened, fill the variables and click the START button.

Variables

authToken

  1. Open the dev tools (F12), open the Network tab. (You should clear all requests for better readability if you see some.)
  2. Delete one message manually. In the request log, you will see a request with a DELETE method.
  3. Click on the request to open the details, and on the Headers tab, copy the 'authorization' token. It's a long text > with dots like MTX5MzQ1MjAyMjU0NjA2MzM2.ROFLMAO.UvqZqBMXLpDuOY3Z456J3JRIfbk.

authorId

  • Right click your avatar in a message you sent in the chat, Copy ID

    NOT THE MESSAGE THE AVATAR.
    (You cannot delete the other's person messages a in DM channel, you will get Error 403)

channelId

  • For public channels: Right click a channel, Copy ID
  • For a DM/Direct messages: copy the number after /@me/ in the URL)

firstMessageId

  • Delete messages after one message:
    Right click a message, Copy ID
  • Delete since the begining of a channel:
    Leave this variable empty "".


DeveloperMode

If the Copy ID menu doesn't show up when right clicking:

  • Enable developer mode in discord Go to user Settings > Appearance in discord and enable Developer mode.

DO NOT SHARE YOUR authToken!

Sharing your authToken on the internet will give full access to your account! There are bots gathering credentials all over the internet. If you post your token by accident, LOGOUT from discord on that same browser you got that token imediately. Changing your password will make sure that you get logged out of every device. I advice that you turn on 2FA afterwards.

If you are unsure do not share screenshots, or copy paste logs on the internet.


DISCLAIMER: THE SOFTWARE AND ALL INFORMATION HERE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

By using any code or information provided here you are agreeing to all parts of the above Disclaimer.

Last tested: 2019-AUG-21

/*
This file is now hosted here:
https://github.com/victornpb/deleteDiscordMessages
*/
@unixfox

This comment has been minimized.

Copy link

@unixfox unixfox commented Apr 11, 2019

Can you handle 429 HTTP errors in the program? I'm getting rate limited after a hundred of messages.
If you need the error message, here it is:

{
  "global": false, 
  "message": "You are being rate limited.", 
  "retry_after": 98150
}
@Fressikus

This comment has been minimized.

Copy link

@Fressikus Fressikus commented Apr 16, 2019

This works fine when deleting messages from a public channel, but throws a 404 error for DMs. Tried with several different people. Can you see if you can reproduce that problem?

@omomoi

This comment has been minimized.

Copy link

@omomoi omomoi commented Apr 22, 2019

Same...404 error

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Apr 23, 2019

Worked well for about 2 hours. Not sure if it is working anymore. Keeps looping "System message? {"hit":true,"attachments":[],"tts":false,"embeds":[]...". Any help?

@victorshx

This comment has been minimized.

Copy link

@victorshx victorshx commented Apr 28, 2019

@DrOverlord May you send me the javascript?

@youmu-kopka

This comment has been minimized.

Copy link

@youmu-kopka youmu-kopka commented May 4, 2019

@DrOverlord i dont see a pm feature on discord, can you please send me your edited javascript?

@pgtc

This comment has been minimized.

Copy link

@pgtc pgtc commented May 4, 2019

Fantastic, thank you so much!

@daredev

This comment has been minimized.

Copy link

@daredev daredev commented May 14, 2019

Doesn't work anymore.

When I paste the function in the console it replies with undefined

image

This is supposed to happen just follow the rest of the instructions.

@Matt0017

This comment has been minimized.

Copy link

@Matt0017 Matt0017 commented May 15, 2019

@daredev It should, just keep going.

@victornpb

This comment has been minimized.

Copy link
Owner Author

@victornpb victornpb commented May 25, 2019

@unixfox are you getting rate limited when trying to delete messages, or when fetching the messages?
you can try to increase the delays, to avoid getting throttled in the first place. I can try to implement it to actually respect, the retry_after later.

  const delayDelete = 500;
  const delaySearch = 1000;

@daredev that's what's supposed to happen, read the README, the instructions are really clear.
There are 4 steps you just did 1,2,3.


@Fressikus this works just fine for deleting DM messages.
In the readme: channelId "copy the number after /@me/ in the URL"


@Soarlyn that's strange, seems like it got stuck in a system message, I need to reproduce this later

@unixfox

This comment has been minimized.

Copy link

@unixfox unixfox commented May 25, 2019

@victornpb I'm getting rate limited when trying to delete messages after running the script for around 4 hours.

@victornpb

This comment has been minimized.

Copy link
Owner Author

@victornpb victornpb commented May 26, 2019

@unixfox I updated the script it should now respect the API throttling, it will wait and retry.
Tested on Server Channels and Private messages.

Screen Shot 2019-05-25 at 8 29 48 PM

@victornpb

This comment has been minimized.

Copy link
Owner Author

@victornpb victornpb commented May 26, 2019

README updated!

@Battletoad08

This comment has been minimized.

Copy link

@Battletoad08 Battletoad08 commented May 27, 2019

Wish there was a video tutorial for this.
The autohotkey scripts always quit working after a voice call in DM's does this quit working as well?

@victornpb

This comment has been minimized.

Copy link
Owner Author

@victornpb victornpb commented May 31, 2019

@Battletoad08 it should delete everything

@gentlerain

This comment has been minimized.

Copy link

@gentlerain gentlerain commented Jun 1, 2019

I got the script to work kinda.. but it is not deleting anything :( it just constantly runs so i have to STOP=1 it. Do you happen to know where I went wrong? I followed all the steps https://gyazo.com/a8d46ab79c0ce4a20cb728d77048f4f9

@JoeCow

This comment has been minimized.

Copy link

@JoeCow JoeCow commented Jun 4, 2019

The script works for a while in DMs but eventually the search will get filled with system messages. Anyone know of a workaround?
my log looks like "Found a System message!? skipping it..." about 35 times followed by "Getting next messages..." which then repeats the same system messages. I guess the fix would be once you have found a system message to specify the date of the search to search just before the system message. I would do it myself but I don't much about coding/scripting
Edit: Even easier I am guessing you could set it to search before the last discovered system message. Looking up the paramater and trying to add the parameter to the script myself but like I said I am not a coder and I certainly don't know how to have to the script do it dynamically but still manually doing it every once in a while is better than it completely stopping.

@JoeCow

This comment has been minimized.

Copy link

@JoeCow JoeCow commented Jun 4, 2019

Okay so I have some moderate success on deleting DMs with lots of system messages.
I edited the following lines on the main script to the following
Line 12

function deleteMessages(authToken, authorId, channelId, afterMessageId, beforeMessageId) {

Line 55

        const deleteAfter = `search?author_id=${authorId}` + (beforeMessageId ? `&max_id=${beforeMessageId}` : '') + (afterMessageId ? `&min_id=${afterMessageId}` : '');

I added the following to the last lines of the start script, replace the old last line and make sure the new variable is there.

var afterMessageId = "";
deleteMessages(authToken, authorId, channelId, firstMessageId, afterMessageId); //start

Make sure you fill in your earliest event message id that the script has already passed or just grab your latest message id. I've noticed it does sometimes skip a couple results but that's better than it not working at all.

I would just make my own fork with the edits already done but I am sure the author or someone will make something proper so I don't see a point in making my own. To be honest I was surprised when it worked.

@victornpb

This comment has been minimized.

Copy link
Owner Author

@victornpb victornpb commented Jun 5, 2019

@JoeCow Thanks for your suggestion, I'll try to get back to this later... the problem is when the search returns a page that only contains system messages. I can automatically increment the dates to skip system messages so you don't have to manually specify it.

@spht

This comment has been minimized.

Copy link

@spht spht commented Jun 10, 2019

Is there a tweak to make it delete messages oldest to newest instead of newest to oldest?

@Remonell

This comment has been minimized.

Copy link

@Remonell Remonell commented Jun 20, 2019

Sadly not working for me:

VM1132:40 Uncaught TypeError: Cannot set property 'innerHTML' of undefined
    at deleteMessages (<anonymous>:40:35)
    at <anonymous>:6:1

@AutumnCyn

This comment has been minimized.

Copy link

@AutumnCyn AutumnCyn commented Jun 21, 2019

I am getting a syntax error:

"Uncaught SyntaxError: Unexpected token"

@iiCarelessness

This comment has been minimized.

Copy link

@iiCarelessness iiCarelessness commented Jun 24, 2019

Still getting undefined after editing the correct information.

@victornpb

This comment has been minimized.

Copy link
Owner Author

@victornpb victornpb commented Jun 25, 2019

I can confirm it still working fine.
Syntax error means you're breaking the code either when copying it or when editing something.
The error at line 40 is probably because you have a popup blocker, just allow popups and try again.

@fodsnei

This comment has been minimized.

Copy link

@fodsnei fodsnei commented Jun 27, 2019

Hi, I get this error

API respondend with non OK status! {code: 0, message: "401: Unauthorized"}

@HonestySoftware

This comment has been minimized.

Copy link

@HonestySoftware HonestySoftware commented Jun 27, 2019

Worked flawless, thank you

@AutumnCyn

This comment has been minimized.

Copy link

@AutumnCyn AutumnCyn commented Jun 28, 2019

I'm not sure what I am doing wrong. I am copying the code straight from here to the dev tools area and replacing my info where I am supposed to. I keep getting the same error.

@nobody0123

This comment has been minimized.

Copy link

@nobody0123 nobody0123 commented Jun 29, 2019

Yup. i'm getting the same error.

@Walarks

This comment has been minimized.

Copy link

@Walarks Walarks commented Jul 1, 2019

It was working as intended about 2 weeks ago. When I try to launch it now, I get this as shown in the image.
issue

@Walarks

This comment has been minimized.

Copy link

@Walarks Walarks commented Jul 3, 2019

By the way, it takes all messages into account, not just one person's for some reason even though I specified user ID.

@lz83

This comment has been minimized.

Copy link

@lz83 lz83 commented Jul 6, 2019

Script worked fine for me. Thank you very much! Is there any way that this script could be modified so that it can keep a history of chat messages in a channel?

@ReturnOfTheScanners

This comment has been minimized.

Copy link

@ReturnOfTheScanners ReturnOfTheScanners commented Jul 18, 2019

Only half works for me, by which I mean it deletes roughly half of my comments but won't even detect the others I've made for some reason. It's not reporting any errors or anything yet the messages are still there, anyone else experience this?

There doesn't seem to be any similar pattern between the messages that are left behind, unless there's something I'm missing.

@victornpb

This comment has been minimized.

Copy link
Owner Author

@victornpb victornpb commented Jul 18, 2019

Check if your messages are appearing on the search on the top right corner of the chat. If they don’t you can wait to see if discord indexes it some time later

@ReturnOfTheScanners

This comment has been minimized.

Copy link

@ReturnOfTheScanners ReturnOfTheScanners commented Jul 18, 2019

Well in the channel I'm clearing out right now I had roughly over 1000 messages before running the program going back to 2017, now it's at 514 messages, some of which go back to that year. Thanks for the quick reply by the way

@ReturnOfTheScanners

This comment has been minimized.

Copy link

@ReturnOfTheScanners ReturnOfTheScanners commented Jul 18, 2019

Check if your messages are appearing on the search on the top right corner of the chat. If they don’t you can wait to see if discord indexes it some time later

Where exactly should I look to find what's not working? Could it be an IP thing or what?

@victornpb

This comment has been minimized.

Copy link
Owner Author

@victornpb victornpb commented Jul 18, 2019

The script deletes all messages that it can find through the search.
If you try something like this:
image
It should be able to delete those 6 results in the example above.
If your search returns 0 results, the script will think it has nothing to delete. You can only wait to see if the search gets up to date with the actual chat. If that's not the case let me know.

@ReturnOfTheScanners

This comment has been minimized.

Copy link

@ReturnOfTheScanners ReturnOfTheScanners commented Jul 18, 2019

Yeah it comes up with results as seen here
Untitled

Untitled

As you can see, the script doesn't pick them up.

UPDATE: Tried it again having given it some time, still the same result as above.

@ReturnOfTheScanners

This comment has been minimized.

Copy link

@ReturnOfTheScanners ReturnOfTheScanners commented Jul 21, 2019

Tried it again on a different server, again same result; deletes a large portion of messages but not all of them.

@Dynamistic

This comment has been minimized.

Copy link

@Dynamistic Dynamistic commented Jul 21, 2019

I have the same problem as ReturnOfTheScanners

Got bored trying to debug.

@not-tw0

This comment has been minimized.

Copy link

@not-tw0 not-tw0 commented Jul 22, 2019

i get API respondend with non OK status! {code: 0, message: "401: Unauthorized"} error all of my info seems to be correct so idk whats going wrong

@Surpysurplus

This comment has been minimized.

Copy link

@Surpysurplus Surpysurplus commented Jul 23, 2019

Can confirm this works.

Also, not-tw0

{code: 0, message: "401: Unauthorized"} - This means you messed up on one of the parts, probably authToken. I had this exact message and when I put in the proper authToken and followed the instructions, it worked. Double check everything is right.

Also,

The way this code deletes, is everything after the ID you are deleting. So finding an ID from earlier, like a few hours ago will delete every following message up until that point.

Hope this makes sense.

@Watterbottle

This comment has been minimized.

Copy link

@Watterbottle Watterbottle commented Jul 24, 2019

Can someone help me? It won't work. It keeps saying deletemessage is not defined.

@ekdms95

This comment has been minimized.

Copy link

@ekdms95 ekdms95 commented Jul 25, 2019

pretty good work yet. thanks

@victornpb

This comment has been minimized.

Copy link
Owner Author

@victornpb victornpb commented Jul 25, 2019

@Watterbottle Just read the instructions, start to finish.
@ReturnOfTheScanners I think I know what could be happening with you, I think you're getting a page which all messages are not yours, so it get stuck on that page, instead of advancing. Try setting firstMessageId to one of your oldest messages, (it deletes from top to bottom, oldest to most recent). Let me know if this does something for you.

Also just to make sure we are on the same page, you can not delete the other persons messages, only yours.

@ReturnOfTheScanners

This comment has been minimized.

Copy link

@ReturnOfTheScanners ReturnOfTheScanners commented Jul 25, 2019

@victornbp I managed to find another code that did work for me, thanks though.

Specifically this one, I'm afraid I forgot the github page I found it on:

clearMessages = function (guild_id, author_id, authToken, deleted = new Set()) {
    /*
     * Discord: Don't copy stuff into this box
     * Me: dOn'T COpy sTuFf iNtO tHIs bOx
     */
    const searchURL = `https://discordapp.com/api/v6/guilds/${guild_id}/messages/search?author_id=${author_id}&include_nsfw=true`
    const headers = { Authorization: authToken }
    let clock = 0
    interval = 500
    function delay(duration) {
        return new Promise((resolve, reject) => {
            setTimeout(resolve, duration)
        })
    }
    function loadMessages() {
        return fetch(searchURL, { headers })
    }
    function tryDeleteMessage(message) {
        // RAce coNDItiOn
        if (message.author.id == author_id && !deleted.has(message.id)) { // skip already deleted messages
            console.log(`Deleting message ${message.id} from ${message.author.username} (${message.content}...)`)
            return fetch(`https://discordapp.com/api/v6/channels/${message.channel_id}/messages/${message.id}`, { headers, method: 'DELETE' })
        }
    }
    let messagesStore = []

    loadMessages()
        .then(resp => resp.json())
        .then(messages => {
            messages = messages.messages
            if (messages === undefined || messages === null || messages.length == 0) {
                console.log(`Couldn't load messages. Check guild id, author id, and auth token.`)
                return
            }
            messages = messages.filter(m => m) // clean undefined
            messages = [].concat.apply([], messages); // flatten
            messages = messages.filter(m => m) // clean undefined
            if (messages.length === 0) {
                console.log(`Couldn't load messages. Check guild id, author id, and auth token.`)
                return
            }
        
            //filter by author
            messages = messages.filter(m => m.author.id == author_id)
            // unique by id
            messages = messages.filter((e, i) => messages.findIndex(a => a.id === e.id) === i);

            beforeId = messages[messages.length-1].id
            messagesStore = messagesStore.concat(messages)
            return Promise.all(messagesStore.map(message => {
                return delay(clock += interval)
                    .then(() => tryDeleteMessage(message))
                    .then(resp => {
                        if (resp) {
                            if (resp.status == 429) {
                                interval += 10
                                console.log(`Too fast; bumping interval to ${interval}`)
                            } else if (resp.status === 204) {
                                deleted.add(message.id) // mark deleted
                                return resp.text()
                            }
                        }
                    })
            }))
        })
        .then(function() {
            if (messagesStore.length !== 0) {
                clearMessages(guild_id, author_id, authToken, deleted)
            } else {
                console.log(`We have loaded all messages in this chat.`)
            }
        })
}
var authToken = " auth token here"
if (authToken.length === 0) {
    var localToken = document.body.appendChild(document.createElement(`iframe`)).contentWindow.localStorage.token
    if (localToken === undefined) {
        console.log(`Getting the auth token from localStorage isn't supported on Chrome or the desktop client. Use Firefox or grab it from a network request's headers.`)
        console.log(`To do that go to the Network tab of your inspector and copy the Authorization header of a request. There are detailed instructions in the tutorial.`)
    } else {
        authToken = JSON.parse(localToken)
    }
}
if (authToken.length !== 0) {
    clearMessages(' ID  ', ' Channel ID ', authToken)
}
@Dynamistic

This comment has been minimized.

Copy link

@Dynamistic Dynamistic commented Jul 26, 2019

^ that doesnt work, anyways loks like the problem is if there is a page full of calls started from authid it cant go further cause its trying to delete them first but of coruse u cant do that.

@Dynamistic

This comment has been minimized.

Copy link

@Dynamistic Dynamistic commented Jul 26, 2019

So yes I have confirmed WHAT the problem is, the solution, I havent figured it out yet. posts that are undeletable that say authid has started call is blocking the delete script because its trying to delete those messages first (if it fits a whole page on the search -> from:user

Ill try to find a work around if i have the time, but i hope OP can work it out before then, please and thanks.

@JoeCow

This comment has been minimized.

Copy link

@JoeCow JoeCow commented Jul 26, 2019

So yes I have confirmed WHAT the problem is, the solution, I havent figured it out yet. posts that are undeletable that say authid has started call is blocking the delete script because its trying to delete those messages first (if it fits a whole page on the search -> from:user

Ill try to find a work around if i have the time, but i hope OP can work it out before then, please and thanks.

I posted a workaround here. This should work still as looking through revisions there has been one minor change to the script since I posted which pushed the second edit down 2 lines but I have edited the linked comment to reflect that. Since I am not a coder and just used logic to edit the script a little it's not the best solution as I do believe you need to reload and paste in the edited scripts every time you fill up with system messages. Would have made my own fork with the changes already done but figure someone who actually knows code will/can come up with something more graceful.

@victornpb

This comment has been minimized.

Copy link
Owner Author

@victornpb victornpb commented Jul 26, 2019

I’ll try to handle this edge case

@Mikri2005

This comment has been minimized.

Copy link

@Mikri2005 Mikri2005 commented Aug 5, 2019

@JoeCow same issues for me. It just kinda stopped working, with the system file errors, and same thing when I tried your update as well. It's been doing this each time.

I've used STOP=0 & STOP=1 to abort, and restart, with both scripts, but I'm still stuck.
Screen Shot 2019-08-04 at 10 36 44 PM

@victornpb any ideas? To add, your original script worked great for one DM, but when I went to switch to another it went through a few hundred, and hit a wall.

@JoeCow

This comment has been minimized.

Copy link

@JoeCow JoeCow commented Aug 5, 2019

@Mikri2005

I've used STOP=0 & STOP=1 to abort, and restart, with both scripts, but I'm still stuck

I never said to use STOP= I could be wrong but as far I can tell it simply pauses the script and once the script is started it wont check for updated variables aside from STOP itself, here's more explicit instructions:

  1. Follow victors instructions and run as normal (I recommend putting the start script in a text editor so that you don't need to fill in the variables again) if the output fills with system message continue to step 2
  2. Reload the webpage you ran the script from
  3. Edit the scripts as I instructed in my comment (Keep both scripts in a text editor as you may need them again depending on how many system messages you have)
  4. Paste in the edited main script and press enter
  5. Fill in the edited start script as you normally would or better yet it should already be filled in. Fill in afterMessageID in the edited start script by going into the dm and finding your most recent message (Discord's search feature is useful here) and copying the message id
  6. Paste in the edited and filled in start script and press enter
  7. Depending on how many system message you have it may eventually fill with them again, in that case reload the webpage and repeat from Step 4 being sure to update var afterMessageId = ""; with your latest message each time
@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Aug 12, 2019

Incredibly unoptimized, slow, and barely functional. Eats up massive amounts of RAM, like 3GB.

Would not recommend using this. Try out this guy's.

@victornpb

This comment has been minimized.

Copy link
Owner Author

@victornpb victornpb commented Aug 13, 2019

I will eventually incorporate the suggestions from the other comments once I get some free time.

@WeaponizedMeme I have no Idea how you came up with this number, Discord takes that amount of RAM not this. The code you recommended uses basically the same approach except it doesn't bother to check anything prior to deleting messages, it doesn't actually check to see if the chat is indexed, doesn't check if you're getting throttled. In fact that other code is slower as it blindly waits half a second between every message, while I implemented an algorithm that actually tries to delete messages as fast as discord allows it without getting rate limited...

The code you linked is shorter in length I'll give you that, but it is shorter for a reason.

@mgcbufly

This comment has been minimized.

Copy link

@mgcbufly mgcbufly commented Aug 18, 2019

Hi. I'm getting an issue where nothing is being deleted.
When I first ran this script it deleted about 20k of my messages, but ever since then the blue numbers on the side just keep increasing while the number of messages stays unchanged.
I only encounter this in a specific DM. The script works in other DMs/servers I've used it in. Any tips or ideas as to what is causing this?

BTW The small decrease in messages is from me manually deleting/clicking while I was hoping the script would start working

image

@xTerminatioNx

This comment has been minimized.

Copy link

@xTerminatioNx xTerminatioNx commented Aug 18, 2019

Worked really well for me. Was a very long DM history I was looking to delete though so did eventually get clogged up with system messages.

Used the recommended modifications here though and that fixed that issue.

Thanks victornpb for the great script and JoeCow for the modifications to combat the system messages.

@xTerminatioNx

This comment has been minimized.

Copy link

@xTerminatioNx xTerminatioNx commented Aug 18, 2019

Hi. I'm getting an issue where nothing is being deleted.
When I first ran this script it deleted about 20k of my messages, but ever since then the blue numbers on the side just keep increasing while the number of messages stays unchanged.
I only encounter this in a specific DM. The script works in other DMs/servers I've used it in. Any tips or ideas as to what is causing this?

BTW The small decrease in messages is from me manually deleting/clicking while I was hoping the script would start working

image

Hello @mgcbufly

This is probably due to system messages.

Eventually they will fill up the queue and not be able to be deleted. So it will keep querying and only getting the same system messages in return.

Use JoeCow's modifications that he described here: https://gist.github.com/victornpb/135f5b346dea4decfc8f63ad7d9cc182#gistcomment-2934064

@Chipiron95

This comment has been minimized.

Copy link

@Chipiron95 Chipiron95 commented Aug 19, 2019

Hey, what can i do with?:

Started at 8/19/2019, 10:47:37 AM
channelId=544122824873476126 authorId=527227515706540053 firstMessageId=
---- You can abort by setting STOP=1 on the console ----
API respondend with non OK status! {"code":0,"message":"401: Unauthorized"}

@victornpb

This comment has been minimized.

Copy link
Owner Author

@victornpb victornpb commented Aug 21, 2019

OK, I finally put some time in handling system messages. It seems to be working now, but I'm limited to generating dummy messages to delete. Please let me know if you find any issue.

Thanks @JoeCow for the contribution. In the end I handled things differently, It should not leave messages behind anymore.

Also I made it simpler to use I implemented a minimal user interface, and I can fill the author and channel you're on automatically, so you only need to provide the authToken. That made the code quite bigger tho. But I don't want to make the code cryptic just to make it short because I want it to still be readable, so pleople can trust it before running it.
Screen Shot 2019-08-21 at 1 47 13 AM

EDIT:

@victornpb

This comment has been minimized.

Copy link
Owner Author

@victornpb victornpb commented Aug 21, 2019

I'm migrating this Gist to a GitHub Repository. It will be easier for me to make changes and answer issues and questions individually using the the issues tab.

Please post your comments, questions, issues, ideas HERE


GIST MOVED TO

https://github.com/victornpb/deleteDiscordMessages

@SKN1

This comment has been minimized.

Copy link

@SKN1 SKN1 commented Dec 26, 2019

Error deleting message, API responded with status 403! {"message":"Cannot execute action on a DM channel","code":50003}

how fix it?

@phrohdoh

This comment has been minimized.

Copy link

@phrohdoh phrohdoh commented Dec 27, 2019

@SKN1 the comment just before yours tells you to ask questions on the GitHub repo, not this gist.

@DYR0S

This comment has been minimized.

Copy link

@DYR0S DYR0S commented Mar 26, 2020

Can I have your discord? I need you with something

@Connor200024

This comment has been minimized.

Copy link

@Connor200024 Connor200024 commented Apr 14, 2020

Isn't this just against discord TOS? ;) My suggestion it's pointless and awful to use! :D

@ZeldaPlayer29

This comment has been minimized.

Copy link

@ZeldaPlayer29 ZeldaPlayer29 commented Jul 12, 2020

Hi, I'm having some trouble using this and wanted to ask if it works for messages in banned servers? I'm filling in all the details, with the exception of GuildID because I can't get that (I think it's the server), but I'm just getting 404 errors.

@TosBreaker

This comment has been minimized.

Copy link

@TosBreaker TosBreaker commented Oct 18, 2020

Anyone wondering. yes. This is a TOS breaker. It WILL get you banned. I do not know if they will delete your account. But this is self botting. Your account will.100% be banned, as I found out.

If discord implemented a function to delete messages, however, it would resolve this issue. Seems they wont though.

I managed to delete a few thousand messages however, before getting banned. Say about in the region of 10,000.

Then I ended up getting banned.

@sc0rp10n-py

This comment has been minimized.

Copy link

@sc0rp10n-py sc0rp10n-py commented Nov 19, 2020

This works fine when deleting messages from a public channel, but throws a 404 error for DMs. Tried with several different people. Can you see if you can reproduce that problem?

for DM
use guild id :@me
and channel id: text after @me/ in url

@sc0rp10n-py

This comment has been minimized.

Copy link

@sc0rp10n-py sc0rp10n-py commented Nov 19, 2020

Same...404 error

for DM
use guild id :@me
and channel id: text after @me/ in url

@CyberpunkVx-1729

This comment has been minimized.

Copy link

@CyberpunkVx-1729 CyberpunkVx-1729 commented Jul 28, 2021

Thanks #victornpb
I owe you one !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment