Last active
September 21, 2023 14:34
-
-
Save st1vms/8a94575fddca133a75f4fb421956c9ff to your computer and use it in GitHub Desktop.
Auto change your Discord nickname
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 json | |
# The Guild ID string to use when changing the nickname | |
guild_id = "000000000000000000" | |
# Discord session cookie string | |
cookie = "Entire Cookie header value when visiting discord, using browser devtools." | |
# Authorization header value | |
# You can retrieve this from any POST/PATCH request when visiting discord, using browser devtools. | |
auth = "Authorization header value string" | |
# User Agent of your choice | |
ua = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0" | |
def change_nick(nick: str, guild_id: str) -> bool: | |
data = json.dumps({"nick": nick}) | |
dlen = len(data) | |
url = f"https://discord.com/api/v9/guilds/{guild_id}/members/@me" | |
headers = { | |
"Host": "discord.com", | |
"User-Agent": ua, | |
"Accept": "*/*", | |
"Accept-Language": "q=0.8,en-US;q=0.5,en;q=0.3", | |
"Referer": f"https://discord.com/channels/{guild_id}", | |
"Content-Type": "application/json", | |
"Authorization": auth, | |
"Content-Length": f"{dlen}", | |
"Origin": "https://discord.com", | |
"DNT": "1", | |
"Alt-Used": "discord.com", | |
"Connection": "keep-alive", | |
"Cookie": cookie, | |
"Sec-Fetch-Dest": "empty", | |
"Sec-Fetch-Mode": "cors", | |
"Sec-Fetch-Site": "same-origin", | |
"TE": "trailers", | |
} | |
res = requests.patch(url, data=data, headers=headers) | |
return res.status_code == 200 | |
if __name__ == "__main__": | |
nick = input("\nInsert new nick\n>>").strip() | |
print(change_nick(nick, guild_id)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment