Created
August 20, 2023 16:23
-
-
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.
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
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