Skip to content

Instantly share code, notes, and snippets.

@michaelowens
Last active August 11, 2016 07:47
Show Gist options
  • Save michaelowens/c50cff049759ab2c8d64835113f38376 to your computer and use it in GitHub Desktop.
Save michaelowens/c50cff049759ab2c8d64835113f38376 to your computer and use it in GitHub Desktop.
Delete all messages in discord channel, the lazy way using mee6.xyz (add bot + enable moderation + enable !clear). When all messages are gone you can either refresh or run `stop_purge = true` in dev tools.
var stop_purge = false;
(function(){
// Go to the channel you want to purge completely (in browser, discordapp.com)
// Open your chrome dev tools (ctrl+shift+i), go to the Network tab.
// Send a message and it should show activity in the network pane. Click on the request you made, the name should be "messages"
// Click on the request, copy the "Request URL" and paste it in between these quotes:
var requestURL = ''
// scroll down to "Request Headers" and grab the key behind "authorization:" and paste it inside these quotes:
var authToken = ''
// paste code (with your codes above) in the console tab, run code (press enter)
// https://github.com/yanatan16/nanoajax
!function(t,e){function n(t){return t&&e.XDomainRequest&&!/MSIE 1/.test(navigator.userAgent)?new XDomainRequest:e.XMLHttpRequest?new XMLHttpRequest:void 0}function o(t,e,n){t[e]=t[e]||n}var r=["responseType","withCredentials","timeout","onprogress"];t.ajax=function(t,a){function s(t,e){return function(){c||(a(void 0===f.status?t:f.status,0===f.status?"Error":f.response||f.responseText||e,f),c=!0)}}var u=t.headers||{},i=t.body,d=t.method||(i?"POST":"GET"),c=!1,f=n(t.cors);f.open(d,t.url,!0);var l=f.onload=s(200);f.onreadystatechange=function(){4===f.readyState&&l()},f.onerror=s(null,"Error"),f.ontimeout=s(null,"Timeout"),f.onabort=s(null,"Abort"),i&&(o(u,"X-Requested-With","XMLHttpRequest"),e.FormData&&i instanceof e.FormData||o(u,"Content-Type","application/x-www-form-urlencoded"));for(var p,m=0,v=r.length;v>m;m++)p=r[m],void 0!==t[p]&&(f[p]=t[p]);for(var p in u)f.setRequestHeader(p,u[p]);return f.send(i),f},e.nanoajax=t}({},function(){return this}());
var deleteLoop = function(){
if (stop_purge) { return }
nanoajax.ajax({
url: requestURL,
method: 'POST',
headers: {
authorization: authToken
},
body: "content=!clear 100&nonce=213196997010653184&tts=false"
}, function(){
setTimeout(deleteLoop, 3000)
})
}
deleteLoop()
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment