Skip to content

Instantly share code, notes, and snippets.

@bennyscripts
Created August 20, 2023 16:23
Show Gist options
  • Save bennyscripts/ae2447937641dff9fbcb3213e249eaec to your computer and use it in GitHub Desktop.
Save bennyscripts/ae2447937641dff9fbcb3213e249eaec to your computer and use it in GitHub Desktop.
A python script that removes all friends and leaves all guilds on a Discord account.
import requests
import time
import os
TOKEN = ""
BASE_API = "https://discord.com/api/v9"
HEADERS = {
"Authorization": TOKEN,
"Content-Type": "application/json",
"User-Agent": "Mozilla/5.0 (Linux; Android 13; SM-A526B Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/111.0.5563.57 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/406.0.0.26.90;]"}
IGNORE_GUILDS = []
IGNORE_FRIENDS = []
def main():
print("πŸ” Getting guilds and friends lists")
guilds = requests.get(BASE_API + "/users/@me/guilds", headers=HEADERS)
friends = requests.get(BASE_API + "/users/@me/relationships", headers=HEADERS)
print(f"βœ… Got {len(guilds.json())} guilds and {len(friends.json())} friends.")
print("😴 Letting API rest so no rate limits...")
time.sleep(1)
print("πŸ” Removing friends...")
for friend in friends.json():
if str(friend["id"]) not in IGNORE_FRIENDS:
requests.delete(BASE_API + "/users/@me/relationships/" + friend["id"], headers=HEADERS)
print(f"βœ… Removed {friend['user']['username']}")
time.sleep(1)
print("βœ… Removed all friends!")
print("😴 Letting API rest so no rate limits...")
time.sleep(2)
print("πŸ” Leaving all guilds...")
for guild in guilds.json():
if str(guild["id"]) not in IGNORE_GUILDS:
requests.delete(BASE_API + "/users/@me/guilds/" + guild["id"], headers=HEADERS, json={"lurking": False})
time.sleep(1)
print("βœ… Left all guilds!")
time.sleep(3)
os.system("clear")
print("βœ… Account reset complete!")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment