import os
from re import M
import requests
import random
import string
import time
import colorama
import sys
import json
import threading
from colorama import Fore, Style, init
from time import sleep
init()

print(f"""

  ▄████  ▄▄▄       ██▓    ▄▄▄      ▒██   ██▒▓██   ██▓  ▄████ ▓█████  ███▄    █ 
 ██▒ ▀█▒▒████▄    ▓██▒   ▒████▄    ▒▒ █ █ ▒░ ▒██  ██▒ ██▒ ▀█▒▓█   ▀  ██ ▀█   █ 
▒██░▄▄▄░▒██  ▀█▄  ▒██░   ▒██  ▀█▄  ░░  █   ░  ▒██ ██░▒██░▄▄▄░▒███   ▓██  ▀█ ██▒
░▓█  ██▓░██▄▄▄▄██ ▒██░   ░██▄▄▄▄██  ░ █ █ ▒   ░ ▐██▓░░▓█  ██▓▒▓█  ▄ ▓██▒  ▐▌██▒
░▒▓███▀▒ ▓█   ▓██▒░██████▒▓█   ▓██▒▒██▒ ▒██▒  ░ ██▒▓░░▒▓███▀▒░▒████▒▒██░   ▓██░
 ░▒   ▒  ▒▒   ▓▒█░░ ▒░▓  ░▒▒   ▓▒█░▒▒ ░ ░▓ ░   ██▒▒▒  ░▒   ▒ ░░ ▒░ ░░ ▒░   ▒ ▒ 
  ░   ░   ▒   ▒▒ ░░ ░ ▒  ░ ▒   ▒▒ ░░░   ░▒ ░ ▓██ ░▒░   ░   ░  ░ ░  ░░ ░░   ░ ▒░
░ ░   ░   ░   ▒     ░ ░    ░   ▒    ░    ░   ▒ ▒ ░░  ░ ░   ░    ░      ░   ░ ░ 
      ░       ░  ░    ░  ░     ░  ░ ░    ░   ░ ░           ░    ░  ░         ░ 
                                             ░ ░                                
""")

os.system("title GalaxyGen - Menu")
realistic=0
botname='botted by alex lol'
invitelink=input(f"[-] Enter invite: ")
threadsamount=50
discord_register_url = "https://discord.com/api/v9/auth/register"

def generate_random_data():
    password = "".join(
        random.choice(string.ascii_letters) for i in range(0, 20)
    ) + "".join(random.choice(string.digits) for i in range(0, 10))
    email = (
        "".join(random.choice(string.ascii_letters) for i in range(0, 20))
        + "".join(random.choice(string.digits) for i in range(0, 10))
        + "@gmail.com"
    )
    username = "".join(
        random.choice(string.ascii_letters) for i in range(0, 7)
    ) + "".join(random.choice(string.digits) for i in range(0, 10))
    fingerprint = "".join(
        random.choice(string.ascii_letters) for i in range(0, 40)
    ) + "".join(random.choice(string.digits) for i in range(0, 10))
    return [password, email, username, fingerprint]

def create_discord_account(captcha_key):
    proxyfile=open("proxies.txt","r").readlines()
    proxy=random.choice(proxyfile)
    proxydict={ 
        "http":f"http://{proxy}",
        "https":f"http://{proxy}"
    }
    headers = {"User-Agent": "Mozilla/5.0", "Content-Type": "application/json"}
    if realistic == 1:
        r=requests.get('https://story-shack-cdn-v2.glitch.me/generators/username-generator?')
        json=r.json['data']
        botname=json['name']
    else:
        namesfile=open("usernames.txt","r").readlines()
        botname=random.choice(namesfile)
        botname=namesfile
    big_random_data=generate_random_data()
    params = {
        "fingerprint": big_random_data[3],
        "email": big_random_data[1],
        "username": botname,
        "password": big_random_data[0],
        "invite":invitelink,
        "consent": True,
        "date_of_birth": "2000-04-05",
        "captcha_key": captcha_key,
    }
    try:
        make_token_request = requests.post(
        url=discord_register_url, json=params, headers=headers,proxies=proxydict
        )
    except:
        return
    try:
        token=make_token_request.json()["token"]
        print(f"[-] Joining Server With Token: {token}")
    except:
        pass
    try:
        token=make_token_request.json()["token"]
        f=open("tokens.txt","a")
        f.write(f"{token}\n")
        f.close()
    except:
        return
def main():
    os.system(f"title GalaxyGen - Threads: {threading.active_count()} - Invite: {invitelink} ")
    r = requests.get('http://47.22.170.206/api/discord?authKey=astroisverysuperhotandawesomenandsmart12345').text
    if r != 'Failed':
        create_discord_account(r)
    
while True:
    if threading.active_count()<=threadsamount:
        threading.Thread(target=main).start()