logger = logging.getLogger('fortnitepy.xmpp') logger.setLevel(level=logging.DEBUG) handler = logging.StreamHandler(sys.stdout) handler.setFormatter( logging.Formatter( '\u001b[35m %(asctime)s:%(levelname)s:%(name)s: %(message)s \u001b[0m' )) logger.addHandler(handler) device_auth_details = get_device_auth_details().get(data['email'], {}) client = commands.Bot(command_prefix='!', auth=fortnitepy.AdvancedAuth( email=data['email'], password=data['password'], prompt_exchange_code=True, delete_existing_device_auths=True, **device_auth_details), status=data['status'], platform=fortnitepy.Platform(data['platform'])) @client.event async def event_device_auth_generate(details: dict, email: str) -> None: store_device_auth_details(email, details) @client.event async def event_ready() -> None: print( crayons.green(
def store_device_auth_details(email, details): existing = get_device_auth_details() existing[email] = details with open(filename, 'w') as fp: json.dump(existing, fp) device_auth_details = get_device_auth_details().get(email, {}) fortnite_bot = fortnite_commands.Bot( command_prefix='!', description=description, auth=fortnitepy.AdvancedAuth( email=email, password=password, prompt_authorization_code=True, delete_existing_device_auths=True, **device_auth_details ) ) discord_bot = discord_commands.Bot( command_prefix='!', description=description, case_insensitive=True ) @fortnite_bot.event async def event_ready():
async def predicate(ctx): return ctx.author.id in info["FullAccess"] return commands.check(predicate) device_auth_details = get_device_auth_details().get(data["email"], {}) prefix = data["prefix"] client = commands.Bot( command_prefix=prefix, case_insensitive=True, auth=fortnitepy.AdvancedAuth( email=data["email"], password=data["password"], prompt_authorization_code=True, delete_existing_device_auths=True, **device_auth_details, ), platform=fortnitepy.Platform(data["platform"]), ) @client.event async def event_device_auth_generate(details, email): store_device_auth_details(email, details) @client.event async def event_ready():
async def event_ready(): log.warning("Client is ready when it is not expected to be.") log.warning("Device details may or may not have been saved.") await client.close() client.run() # Loading Clients clients = [] c = db.cursor() c.execute("""SELECT * FROM `accounts`;""") for data in c.fetchall(): clients.append( commands.Bot(command_prefix="/", auth=fortnitepy.AdvancedAuth(email=data[1], password=data[2], device_id=data[3], account_id=data[4], secret=data[5]))) # Loading Extensions for ext in os.listdir("extensions"): if ext.endswith(".py") and os.path.isfile(f"extensions/{ext}.py"): try: for c in clients: c.load_extension(f"extensions.{ext[:-3]}") log.info(f"$GREENLoaded Extension $CYAN{ext[:-3]}$GREEN.") except: log.warning(f"Cannot Load Extension $CYAN{ext}$YELLOW.") elif os.path.isdir(f"extensions/{ext}") and os.path.isfile( f"extensions/{ext}/main.py"):
return json.load(fp) return {} def store_device_auth_details(email, details): existing = get_device_auth_details() existing[email] = details with open(filename, 'w') as fp: json.dump(existing, fp) device_auth_details = get_device_auth_details().get(client.courriel, {}) bot = commands.Bot( command_prefix=client.prefix, auth=fortnitepy.AdvancedAuth( email=client.courriel, password=client.wordpass, prompt_authorization_code=True, delete_existing_device_auths=True, **device_auth_details ) ) fortnite_api_async = FortniteAPIAsync.APIClient() print(crayons.cyan('PY MAKER BY VAXS RSB YOUTUBE: https://www.youtube.com/channel/UCIK7oxSNPt8MCrphoL5MEPA')) print(crayons.cyan('IF YOU WONT TO SUPPORT ME USE CODE VAXS-RSB IN THE ITEM SHOP')) @bot.event() async def event_ready(): print('██████╗ ██╗ ██╗ ██████╗ ██████╗ ████████╗') print('██╔══██╗╚██╗ ██╔╝ ██╔══██╗██╔═══██╗╚══██╔══╝') print('██████╔╝ ╚████╔╝█████╗██████╔╝██║ ██║ ██║ ')
details["email"] = data.get("Email", "") if data.get("Account ID", "") == "automagically-filled": return details # Only return email if nothing else is present details["account_id"] = data.get("Account ID", "") details["device_id"] = data.get("Device ID", "") details["secret"] = data.get("Secret", "") return details # Return saved details ## Loading Clients clients = {} for client in config: clients[client] = commands.Bot(command_prefix="", auth=fortnitepy.AdvancedAuth( prompt_authorization_code=True, **get_details(client))) log.info(f"Loaded {len(config)} Clients.") ## Loading Extensions for ext in os.listdir("extensions"): if ext.endswith(".py"): # Simple Extensions try: for client in list(clients.values()): client.load_extension(f"extensions.{ext[:-3]}") log.info(f"$GREENLoaded Extension $CYAN{ext[:-3]}$GREEN.") except: log.warning(f"Cannot Load Extension $CYAN{ext}$YELLOW.") elif os.path.isdir(f"extensions/{ext}") and os.path.isfile( f"extensions/{ext}/main.py"):