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) |
ts just puts my token in the console and doesnt do anything
For people who dont have python / dont know how to install it i made an exe version
@MetaShrimps If it doesn't do anything that most likely means you put a invalid token or you didn't press enter after pasting your token :)
@MetaShrimps are you using python?
here's a version that attempts to claim the decoration after 30 items, also looks more organised.
# original: https://gist.github.com/EricPanDev/4238407328fe08ab9b1ec8b1a00322aa
# modified by: SL4F
# imports
import requests, json, base64, time, sys
from colorama import Fore, Style
# initial info
token = input(f"{Fore.RED} ▸{Fore.GREEN} [AutoLootbox] {Fore.WHITE}Copy and paste user token.\n{Fore.RED} ▸ {Fore.RESET}")
o=0
ui = 0
last_request_time = time.time()
X_Super = {"client_build_number":280346}
headers = {
'authorization': token,
'x-super-properties': base64.b64encode(json.dumps(X_Super).encode('utf-8')).decode('utf-8'),
}
# requests
while True:
response = requests.post('https://discord.com/api/v9/users/@me/lootboxes/open', headers=headers, timeout=10)
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(f"""{Fore.RED} ▸{Fore.GREEN} [AutoLootbox] {Fore.WHITE}Item Opened! {Fore.LIGHTBLACK_EX}{response.json()['opened_item']} {Fore.WHITE}Total Opened: {Fore.LIGHTBLACK_EX}{o} {Fore.WHITE}Inventory Items: {Fore.LIGHTBLACK_EX}{ui}
{Fore.WHITE}Time between requests: {Fore.LIGHTBLACK_EX}{round(time_between_requests, 3)} seconds.{Fore.RESET}\n""")
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(f"{Fore.RED} ▸ [AutoLootbox] {Fore.YELLOW}Token Invalid supplied, exiting.{Style.RESET_ALL}\n")
sys.exit(0)
if o >= 30:
r = requests.post('https://discord.com/api/v9/users/@me/lootboxes/redeem-prize', headers=headers, timeout=10)
if r.status_code == 200:
print(f"{Fore.RED} ▸{Fore.GREEN} [AutoLootbox] {Fore.YELLOW}Claimed decoration.\n{Fore.RESET}")
sys.exit(0)
else:
print(f"{Fore.RED} ▸ [AutoLootbox] {Fore.YELLOW}Cannot claim decoration.\n{Fore.RESET}")```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lol