import requests import tqdm PROMOTION_ID = "1180231712274387115" DISCORD_BASE_URL = "https://discord.com/billing/partner-promotions" DISCORD_API_URL = "https://api.discord.gx.games/v1/direct-fulfillment" def generate_nitro(): headers = {'content-type': 'application/json'} data = {'partnerUserId': ''} resp = requests.post(DISCORD_API_URL, headers=headers, json=data) if resp.status_code != 200: print("Error generating nitro code: " + resp.text) return None token = resp.json()["token"] return f"{DISCORD_BASE_URL}/{PROMOTION_ID}/{token}" number_of_codes = int(input("How many codes do you want to generate? ")) # anything over 100-150 will get you rate-limited/ip-banned file_name = input("What do you want to name the file? ") with open(file_name, "w") as f: for _ in tqdm.tqdm(range(number_of_codes)): output = None while output == None: output = generate_nitro() f.write(output + "\n")