def __init__(self, details: dict, ws): self.ws = ws self.party_hidden = False self.hidden = [] super().__init__( auth=fortnitepy.DeviceAuth(**details), build="1:2:", )
def __init__(self, details: dict, ws): self.ws = ws self.party_hidden = False self.hidden = [] super().__init__( auth=fortnitepy.DeviceAuth(**details), build="++Fortnite+Release-14.10-CL-14276912-Windows", )
def __init__(self, settings: BotSettings, device_auths: DeviceAuths) -> None: self.device_auths = device_auths.get_device_auth() self.settings = settings self.fortnite_api = FortniteAPIAsync.APIClient() super().__init__(command_prefix='!', auth=fortnitepy.DeviceAuth( device_id=self.device_auths.device_id, account_id=self.device_auths.account_id, secret=self.device_auths.secret), status=self.settings.status, platform=fortnitepy.Platform(self.settings.platform))
async def api_add_account(request): if not "deviceID" in request.json and not "accountID" in request.json and not "secret" in request.json: return sanic.response.json( {"error": "Some or all parts of the device auths are missing!"}) if fn_client._start: return sanic.response.json({"error": "The Client is already running!"}) # Check if the device Auth is valid! async with aiohttp.ClientSession() as session: deviceAuth = await (await session.post( 'https://account-public-service-prod.ol.epicgames.com/account/api/oauth/token', data={ 'grant_type': 'device_auth', 'device_id': request.json["deviceID"], 'account_id': request.json["accountID"], 'secret': request.json["secret"], 'token_type': 'eg1' }, headers={ "Authorization": "basic MzQ0NmNkNzI2OTRjNGE0NDg1ZDgxYjc3YWRiYjIxNDE6OTIwOWQ0YTVlMjVhNDU3ZmI5YjA3NDg5ZDMxM2I0MWE=" })).json() # Download the cosmetics if "errorCode" in deviceAuth: if deviceAuth[ "errorCode"] == "errors.com.epicgames.account.invalid_account_credentials": return sanic.response.json({ "status": "failed", "errorCode": "errors.com.epicgames.account.invalid_account_credentials", "error": "Sorry the account credentials you are using are invalid" }) else: print( f'Device Auth is working.\nUserName: {deviceAuth["displayName"]}' ) settings = json.loads(open("settings.json").read()) settings["account"]["accountID"] = request.json["accountID"] settings["account"]["deviceID"] = request.json["deviceID"] settings["account"]["secret"] = request.json["secret"] open("settings.json", "w+").write(json.dumps(settings, indent=2)) fn_client._start = True fn_client.auth = fortnitepy.DeviceAuth( device_id=request.json["deviceID"], account_id=request.json["accountID"], secret=request.json["secret"]) fn_client.auth.initialize(fn_client) def done_callback(error): exception = error.exception() fn_client.exception = str(exception) fn_client._start = False loop.create_task( fn_client.start()).add_done_callback(done_callback) while not fn_client.is_ready(): if fn_client.exception: return sanic.response.json({ "status": "failed", "error": fn_client.exception }) await asyncio.sleep(0.1) if fn_client.is_ready(): return sanic.response.json({ "status": "success", "display_name": fn_client.user.display_name, "user_id": fn_client.user.id })
headers={ "Authorization": "basic MzQ0NmNkNzI2OTRjNGE0NDg1ZDgxYjc3YWRiYjIxNDE6OTIwOWQ0YTVlMjVhNDU3ZmI5YjA3NDg5ZDMxM2I0MWE=" }).json() if "errorCode" in deviceAuth: if deviceAuth[ "errorCode"] == "errors.com.epicgames.account.invalid_account_credentials": _invalid_device_auth() else: print(f'Unknown error, please report it {deviceAuth["errorCode"]}') else: print(f'DeviceAuth is working!\nUserName: {deviceAuth["displayName"]}') fn_client._start = True fn_client.auth = fortnitepy.DeviceAuth( device_id=fn_client.settings["account"]["deviceID"], account_id=fn_client.settings["account"]["accountID"], secret=fn_client.settings["account"]["secret"]) fn_client.auth.initialize(fn_client) async def start(): print('Starting the Bot now!') try: await fn_client.start() except fortnitepy.AuthException: print('Sorry something wen\'t wrong with your deviceAuth!') _invalid_device_auth() loop.create_task(start()) # Start the client else: os.system("clear") print(
def __init__(self, auth, cosmetics, exchange_code=None, config=None, *args, **kwargs): self.cosmetics = cosmetics self.config = config self.__auth = auth if "deviceAuth" in auth.keys(): self.__auth = auth["deviceAuth"] if not auth and not exchange_code: raise Exception("DEVICE AUTH OR EXCHANGE CODE!") self.invited_on_startup = 0 self.got_ready = 0 self.was_offline = {} self.resent = {} if "deviceId" in self.__auth.keys(): self.deviceId = self.__auth["deviceId"] elif "device_id" in self.__auth.keys(): self.deviceId = self.__auth["device_id"] else: self.deviceId = "" if not exchange_code: raise Exception("Auth nicht richtig angegeben.") if "accountId" in self.__auth.keys(): self.accountId = self.__auth["accountId"] elif "account_id" in self.__auth.keys(): self.accountId = self.__auth["account_id"] else: self.accountId = "" if not exchange_code: raise Exception("Auth nicht richtig angegeben.") if "secret" in self.__auth.keys(): self.secret = self.__auth["secret"] else: self.secret = "" if not exchange_code: raise Exception("Auth nicht richtig angegeben.") super().__init__( auth=fortnitepy.DeviceAuth( account_id=self.accountId, device_id=self.deviceId, secret=self.secret, exchange_code=exchange_code if exchange_code else "" ), status='🔥 YT: SAC Doener 🔥', default_party_member_config=fortnitepy.DefaultPartyMemberConfig(meta=[ partial(ClientPartyMember.set_outfit, config.get("COSMETIC_SETTINGS", {}).get("OUTFIT", "CID_028_Athena_Commando_F")), partial(ClientPartyMember.set_backpack, config.get("COSMETIC_SETTINGS", {}).get("BACKPACK", "BID_138_Celestial")), partial(ClientPartyMember.set_pickaxe, config.get("COSMETIC_SETTINGS", {}).get("PICKAXE", "Pickaxe_ID_013_Teslacoil")), partial(ClientPartyMember.set_banner, config.get("COSMETIC_SETTINGS", {}).get("BANNER", "InfluencerBanner38"), season_level=config.get("COSMETIC_SETTINGS", {}).get("LEVEL", "9999"), color=config.get("COSMETIC_SETTINGS", {}).get("BANNER_COLOR", "black")), partial(ClientPartyMember.set_battlepass_info, has_purchased=True, level=config.get("COSMETIC_SETTINGS", {}).get("BATTLEPASS_LEVEL", "9999"), self_boost_xp=True, friend_boost_xp=True) ]), avatar=fortnitepy.Avatar( asset=config.get("COSMETIC_SETTINGS", {}).get("AVATAR", "CID_028_Athena_Commando_F"), background_colors=config.get("COSMETIC_SETTINGS", {}).get("AVATAR_COLOR", ["#ffffff", "#ffffff", "#ffffff"]) ), ) self.default_skin = config.get("COSMETIC_SETTINGS", {}).get("SKIN", "CID_017_Athena_Commando_M") self.default_pickaxe = config.get("COSMETIC_SETTINGS", {}).get("PICKAXE", "Pickaxe_ID_013_Teslacoil") self.default_backpack = config.get("COSMETIC_SETTINGS", {}).get("BACKPACK", "BID_138_Celestial") self.default_banner = config.get("COSMETIC_SETTINGS", {}).get("BANNER", "InfluencerBanner38") self.default_banner_color = config.get("COSMETIC_SETTINGS", {}).get("BANNER_COLOR", "black") self.default_level = config.get("COSMETIC_SETTINGS", {}).get("LEVEL", "9999") self.cosmetics = cosmetics self.playlists = playlists self.app = app self.server = server
print(f'{now} {crayons.white("[INFO]")} {content}') elif mode == 'debug': if settings['debug'] == True: print(f'{now} {crayons.blue("[DEBUG]")} {content}') with open('device_auths.json', 'r', encoding='utf-8') as d: auths = json.load(d) with open('settings.json', 'r', encoding='utf-8') as s: settings = json.load(s) client = fortnitepy.Client( auth=fortnitepy.DeviceAuth(device_id=auths['device_id'], account_id=auths['account_id'], secret=auths['secret'])) @client.event async def event_ready(): log('Fortnitepy client ready', 'debug') try: await RPC.connect() log('Connected to discord', 'rpc') except Exception as e: client.loop.create_task(try_to_connect_rpc()) await client.party.edit_and_keep( partial(client.party.set_privacy,