Skip to content

Instantly share code, notes, and snippets.

@MayankFawkes
Created October 1, 2019 16:39
Show Gist options
  • Save MayankFawkes/00019b73d0f05135337d4047dbd74beb to your computer and use it in GitHub Desktop.
Save MayankFawkes/00019b73d0f05135337d4047dbd74beb to your computer and use it in GitHub Desktop.
delete all discord messages
import json, requests, sys
def logo():
print("\n\t██████╗ ██╗███████╗ ██████╗ ██████╗ ██████╗ ██████╗ ")
print("\t██╔══██╗██║██╔════╝██╔════╝██╔═══██╗██╔══██╗██╔══██╗")
print("\t██║ ██║██║███████╗██║ ██║ ██║██████╔╝██║ ██║")
print("\t██║ ██║██║╚════██║██║ ██║ ██║██╔══██╗██║ ██║")
print("\t██████╔╝██║███████║╚██████╗╚██████╔╝██║ ██║██████╔╝")
print("\t╚═════╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ")
print("\t=================+I am Ready+=======================")
logo()
username1 = "GoodBye 👋 (NERD)"
username2 = "GoodBye 👋 (NERD)#2681"
auth_token = "NTA3NjA1Mzg0ODQ5MTI5NTAz.XStrdA.aeuIFPHsxNbKT-o1EW8G9DYGcpg"
channel_id = input("\n[OKAY] Enter ID \nanonymous@root~# ")
delete_from_all_users = "False"
print ("anonymous@root~# Delete all messages from channel " + channel_id)
def get_all_messages(auth, id, last="", prev=[]):
if not last:
messages = json.loads(requests.get("http://canary.discordapp.com/api/v6/channels/" + id + "/messages", headers={"authorization": auth}, params={"limit": 100}).content)
else:
messages = json.loads(requests.get("http://canary.discordapp.com/api/v6/channels/" + id + "/messages", headers={"authorization": auth}, params={"before" : last, "limit" : 100}).content)
prev = prev + messages
if len(messages) < 100:
print ("anonymous@root~# "+str(len(prev)) + " Messages Found")
return prev
else:
oldest = sorted(messages, key=lambda x: x["timestamp"], reverse=True)[-1]
return get_all_messages(auth, id, last=oldest["id"], prev=prev)
def delete_all(auth, id, user1, user2, messages):
print ("anonymous@root~# Trying to delete all messages in " + id + " from username " + user1)
c=0
print("\nanonymous@root~# Deleting Message Started")
for message in messages:
#print(message["author"]["username"])
if (message["author"]["username"] == user1):
c+=1
requests.delete("http://canary.discordapp.com/api/v6/channels/" + id + "/messages/" + message["id"],headers={"authorization": auth})
if c%10==0:
print("[+] "+str(c)+" Message Deleted")
print ("\nanonymous@root~# All messages were delete")
exit=input("anonymous@root~# Message Deleted Sucessfull Press Enter to Exit")
delete_all(auth_token, channel_id, username1, username2, get_all_messages(auth_token, channel_id))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment