Created
November 7, 2022 20:06
-
-
Save 4skl/9e7548efc360c8ac2a8133cc321aa48b to your computer and use it in GitHub Desktop.
Script to delete discord messages in a channel based on user id
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is not really perfect to use and has the risk to ban you based on discord TOS on automation. | |
s : server id | |
c : channel id | |
a : user id | |
m : id of message to start from | |
You also need to fill in "x-super-properties" and "authorization" with your datas. | |
Good luck :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let delete_msg = (c, m, s = '') => { | |
fetch("https://discord.com/api/v9/channels/" + c + "/messages/" + m, { | |
"headers": { | |
"accept": "*/*", | |
"accept-language": "fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7", | |
"authorization": [...], | |
"cache-control": "no-cache", | |
"pragma": "no-cache", | |
"sec-ch-ua": "\"Google Chrome\";v=\"107\", \"Chromium\";v=\"107\", \"Not=A?Brand\";v=\"24\"", | |
"sec-ch-ua-mobile": "?0", | |
"sec-ch-ua-platform": "\"Windows\"", | |
"sec-fetch-dest": "empty", | |
"sec-fetch-mode": "cors", | |
"sec-fetch-site": "same-origin", | |
"x-debug-options": "bugReporterEnabled", | |
"x-discord-locale": "fr", | |
"x-super-properties": [...] | |
}, | |
"referrer": "https://discord.com/channels/" + s + "/" + c, | |
"referrerPolicy": "strict-origin-when-cross-origin", | |
"body": null, | |
"method": "DELETE", | |
"mode": "cors", | |
"credentials": "include" | |
}); | |
} | |
let nuke = (c, a, m = '', s = '') => fetch("https://discord.com/api/v9/channels/" + c + "/messages?before=" + m + "&limit=50", { | |
"headers": { | |
"accept": "*/*", | |
"accept-language": "fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7", | |
"authorization": [...], | |
"cache-control": "no-cache", | |
"pragma": "no-cache", | |
"sec-ch-ua": "\"Google Chrome\";v=\"107\", \"Chromium\";v=\"107\", \"Not=A?Brand\";v=\"24\"", | |
"sec-ch-ua-mobile": "?0", | |
"sec-ch-ua-platform": "\"Windows\"", | |
"sec-fetch-dest": "empty", | |
"sec-fetch-mode": "cors", | |
"sec-fetch-site": "same-origin", | |
"x-debug-options": "bugReporterEnabled", | |
"x-discord-locale": "fr", | |
"x-super-properties": [...] | |
}, | |
"referrer": "https://discord.com/channels/"+s+"/"+c, | |
"referrerPolicy": "strict-origin-when-cross-origin", | |
"body": null, | |
"method": "GET", | |
"mode": "cors", | |
"credentials": "include" | |
}).then(r => r.json()).then(j => { | |
let count = 0; | |
for (let m of j) { | |
if (m.channel_id == c && m.author.id == a) { setTimeout(() => delete_msg(c, m.id, s=s), 500+500*count+300*Math.random()); count++; } | |
} | |
console.log('deleting : ', count); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment