Last active
April 3, 2024 01:32
-
-
Save EricPanDev/4238407328fe08ab9b1ec8b1a00322aa to your computer and use it in GitHub Desktop.
Automatically open discord lootboxes
This file contains 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
token = input("Copy and paste user token: ") | |
import requests, json, base64, time, sys | |
X_Super = {"client_build_number":280346} | |
headers = { | |
'authorization': token, | |
'x-super-properties': base64.b64encode(json.dumps(X_Super).encode('utf-8')).decode('utf-8'), | |
} | |
o=0 | |
ui = 0 | |
last_request_time = time.time() | |
while True: | |
response = requests.post('https://discord.com/api/v9/users/@me/lootboxes/open', headers=headers) | |
if 'user_lootbox_data' in response.json(): | |
if 'opened_items' in response.json()['user_lootbox_data']: | |
ui = sum(response.json()['user_lootbox_data']['opened_items'].values()) | |
if 'opened_item' in response.json(): | |
o += 1 | |
current_time = time.time() | |
time_between_requests = current_time - last_request_time | |
last_request_time = current_time | |
print("[AutoLootbox] >> Item Opened!", response.json()['opened_item'], "Total Opened:",o, "Inventory Items:", ui) | |
print("[AutoLootbox] >> Time between requests:", time_between_requests, "seconds") | |
if "retry_after" in response.json(): | |
time.sleep(response.json()["retry_after"] if response.json()["retry_after"] > 0 else 0) | |
if response.status_code == 401: | |
print("[AutoLootbox] >> Token Invalid supplied, exiting.") | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
here's a version that attempts to claim the decoration after 30 items, also looks more organised.