Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
Sitois authored Feb 13, 2024
1 parent 5beedb5 commit 97963de
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
colorama
requests
48 changes: 48 additions & 0 deletions tool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import requests
import base64
from colorama import Fore, Style, Back

print(Fore.LIGHTGREEN_EX + """ _______ ______ ________ __
/ \ / \ / | / |
$$$$$$$ |/$$$$$$ |______ $$$$$$$$/______ ______ $$ |
$$ |__$$ |$$ |_ $$// \ $$ | / \ / \ $$ |
$$ $$/ $$ | /$$$$$$ | $$ |/$$$$$$ |/$$$$$$ |$$ |
$$$$$$$/ $$$$/ $$ | $$ | $$ |$$ | $$ |$$ | $$ |$$ |
$$ | $$ | $$ |__$$ | $$ |$$ \__$$ |$$ \__$$ |$$ |
$$ | $$ | $$ $$/ $$ |$$ $$/ $$ $$/ $$ |
$$/ $$/ $$$$$$$/ $$/ $$$$$$/ $$$$$$/ $$/
$$ |
$$ |
$$/ """, Style.RESET_ALL)


token = input("Bot Token: ")
path_pfp = input("New animated avatar Path: ")

def update_avatar():
try:
with open(path_pfp, 'rb') as file:
new_avatar = file.read()

headers = {
'Authorization': f'Bot {token}',
'Content-Type': 'application/json'
}

avatar_base64 = base64.b64encode(new_avatar).decode('utf-8')
body = {
'avatar': f'data:image/gif;base64,{avatar_base64}'
}

response = requests.patch('https://discord.com/api/v9/users/@me', headers=headers, json=body)

if response.ok:
print(Fore.GREEN, "[+]", Fore.LIGHTGREEN_EX + 'Avatar updated successfully!', Style.RESET_ALL)
print(Fore.GREEN, "[!!!]", Fore.LIGHTGREEN_EX + 'don\'t forget to leave a star! (https://github.com/Sitois/Pfp-Tool)', Style.RESET_ALL)
else:
print(Fore.RED, "[!]", Fore.LIGHTRED_EX, 'Failed to update avatar:', response.status_code)
print('Response body:', response.text, Style.RESET_ALL)
except Exception as e:
print(Fore.RED, "[!]", Fore.LIGHTRED_EX, 'Error while updating avatar:', e, Style.RESET_ALL)

update_avatar()

0 comments on commit 97963de

Please sign in to comment.