async def LoadAccount(fnClient, Email, Password): client = fortnitepy.Client( email=Email, password=Password, platform=fnClient.platform, default_party_member_config=fnClient.default_party_member_config, status=fnClient.status, loop=fnClient.loop) client.Settings = fnClient.Settings client.DefaultLang = fnClient.DefaultLang client.mainID = fnClient.mainID client.starting = True client.RemovingFriends = False fnClient.loop.create_task(client.start()) await client.wait_until_ready() fnClient.Clients[client.user.id] = client @client.event async def event_ready(): await ready.Ready(client) @client.event async def event_friend_add(friend): await friends.event_friend_add(client, friend) @client.event async def event_friend_remove(friend): await friends.event_friend_remove(client, friend) @client.event async def event_friend_request(friend): await friends.event_friend_request(client, friend) @client.event async def event_party_invite(invitation): await party.event_party_invite(client, invitation) @client.event async def event_party_member_promote(old_leader, new_leader): await party.event_party_member_promote(client, old_leader, new_leader) @client.event async def event_party_member_join(Member): await party.event_party_member_join(client, Member) @client.event async def event_friend_message(Message): await message.Command(client, Message) @client.event async def event_party_message(Message): await message.Command(client, Message)
async def get_device_auth(email, password, code): device_auth_details = get_device_auth_details().get(email.lower(), {}) auth = fortnitepy.AdvancedAuth(email=email, password=password, authorization_code=code, delete_existing_device_auths=True, **device_auth_details) client = fortnitepy.Client(auth=auth) client.add_event_handler('event_device_auth_generate', event_device_auth_generate) client.add_event_handler('event_ready', event_ready) global current_client current_client = client await client.start()
def start(self): self.client = fortnitepy.Client( auth=fortnitepy.AdvancedAuth( email=self.email, exchange_code=self.get_code, device_id=self.device_id, account_id=self.client_id, secret=self.secret ) ) self.client.add_event_handler("friend_message", self.test_commands) self.client.add_event_handler("party_message", self.test_commands) self.client.add_event_handler("ready", self.on_ready) self.client.add_event_handler("party_invite", self.on_invite)
async def load_sub_account(self, email, password): client = fortnitepy.Client(email=email, password=password, loop=self.loop) # register events here with Client.add_event_handler() client.add_event_handler('friend_request', self.event_sub_friend_request) self.loop.create_task(client.start()) await client.wait_until_ready() self.instances[client.user.id] = client # add code here that should be executed once this client is ready print('{0.user.display_name} ready.'.format(client))
async def LoadAccount(fnClient,Email,Password): client = fortnitepy.Client(email=Email,password=Password,platform=fnClient.platform,default_party_member_config=fnClient.default_party_member_config,status='Discord: https://discord.gg/jxgZH6Z\nTwitter: @LupusLeaks\nGET YOUR OWN BOT FOR FREE!',loop=fnClient.loop) client.Settings = fnClient.Settings client.mainID = fnClient.mainID client.randomizing = False client.RemovingFriends = False @client.event async def event_friend_add(friend): await friends.event_friend_add(client, friend) @client.event async def event_friend_remove(friend): await friends.event_friend_remove(client, friend) @client.event async def event_friend_request(friend): await friends.event_friend_request(client, friend) @client.event async def event_party_invite(invitation): await party.event_party_invite(client, invitation) @client.event async def event_party_member_join(Member): await party.event_party_member_join(client,Member) @client.event async def event_party_member_promote(old_leader, new_leader): await party.event_party_member_promote(client, old_leader,new_leader) @client.event async def event_party_message(Message): await message.Command(client, Message) @client.event async def event_friend_message(Message): await message.Command(client, Message) try: fnClient.loop.create_task(client.start()) await client.wait_until_ready() fnClient.Clients[client.user.id] = client except: pass
async def event_ready(self): print('Main client ready. Launching sub-accounts...') clients = [] device_auths = get_device_auth_details() for email, password in credentials.items(): client = fortnitepy.Client( auth=fortnitepy.AdvancedAuth(email=email, password=password, prompt_authorization_code=True, prompt_code_if_invalid=True, delete_existing_device_auths=True, **device_auths.get(email, {})), default_party_member_config=fortnitepy. DefaultPartyMemberConfig(meta=( functools.partial( fortnitepy.ClientPartyMember.set_outfit, 'CID_175_Athena_Commando_M_Celestial'), # galaxy skin ))) # register events here client.add_event_handler('device_auth_generate', self.event_sub_device_auth_generate) client.add_event_handler('friend_request', self.event_sub_friend_request) client.add_event_handler('party_member_join', self.event_sub_party_member_join) clients.append(client) try: await fortnitepy.start_multiple( clients, ready_callback=self.event_sub_ready, all_ready_callback=lambda: print('All sub clients ready')) except fortnitepy.AuthException: print( 'An error occured while starting sub clients. Closing gracefully.' ) await self.close()
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, {}) client = fortnitepy.Client( auth=fortnitepy.AdvancedAuth( email=email, #put email where it says email the second in quotations (eg. "*****@*****.**") password=password, #put password where it says password the second time in quotations (eg. "password") prompt_exchange_code=True, delete_existing_device_auths=True, **device_auth_details ) ) @client.event async def event_device_auth_generate(details, email): store_device_auth_details(email, details) @client.event async def event_ready(): global ready print('Client ready as {0.user.display_name}'.format(client))
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) else: print( f"[FORTNITEPY] [{getTime()}] Debug logging is off. (This isn't an error!)" ) client = fortnitepy.Client(email=data['email'], password=data['password'], status=data['status'], platform=fortnitepy.Platform(data['platform'])) @client.event async def event_ready(): print( Fore.GREEN + f'[FORTNITEPY] [{getTime()}] Client ready as {client.user.display_name}.' ) @client.event async def event_party_invite(invite): await invite.accept() print(f'[FORTNITEPY] [{getTime()}] Accepted party invite.')
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) email = data['email'] password = data['password'] device_auth_details = get_device_auth_details().get(email, {}) client = fortnitepy.Client( auth=fortnitepy.AdvancedAuth(email=email, password=password, prompt_exchange_code=True, delete_existing_device_auths=True, **device_auth_details)) @client.event async def event_device_auth_generate(details, email): store_device_auth_details(email, details) @client.event async def event_ready(): global ready print('Client ready as {0.user.display_name}'.format(client)) member = client.party.me await member.edit_and_keep(
import fortnitepy import pkg_resources from subprocess import call from zipfile import ZipFile from collections import namedtuple from .utils import load_defaults, authorized, add_event_handlers, update_check update_check() # Update the cosmetics,playlists app = sanic.Sanic('') loop = asyncio.get_event_loop() fn_client.settings = json.loads(open("settings.json").read()) fn_client = fortnitepy.Client( status=fn_client.settings['Open EZFN Settings']['Status'], auth=fortnitepy.AdvancedAuth(prompt_exchange_code=False, delete_existing_device_auths=True)) fn_client._start = False fn_client.exception = "" loop.create_task(add_event_handlers(fn_client)) loop.create_task(app.create_server(return_asyncio_server=True)) # Start sanic load_defaults(fn_client) # Load default party settings and other stuff def _invalid_device_auth(): settings = json.loads(open("settings.json").read()) # Remove the not working account from the settings settings["account"]["deviceID"] = "" settings["account"]["accountID"] = "" settings["account"]["secret"] = ""
@dclient.event async def on_message(message: discord.Message): if message.channel.id == 718979003968520283: if "start" in message.content.lower(): await message.delete() await start_bot(message.author, 5400) else: await message.delete() elif type(message.channel) == discord.DMChannel: await parse_command(message) for a in accounts: auth = fortnitepy.AdvancedAuth( email=accounts[a]['Email'], password=accounts[a]['Password'], account_id=accounts[a]['Account ID'], device_id=accounts[a]['Device ID'], secret=accounts[a]['Secret'] ) client = fortnitepy.Client( auth=auth, platform=fortnitepy.Platform.MAC ) clients[a] = client available[a] = client for s in (signal.SIGHUP, signal.SIGTERM, signal.SIGINT): loop.add_signal_handler(s, shutdown) loop.set_exception_handler(loopexcepthook) loop.run_forever()
openurl( "https://www.epicgames.com/id/login/epic?redirect_uri=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect%3FclientId%3D3446cd72694c4a4485d81b77adbb2141%26responseType%3Dcode" ) with prompt_toolkit.patch_stdout.patch_stdout(): try: return_url = prompt_toolkit.prompt( "Paste Here & Press Enter: ") except KeyboardInterrupt: break authorization_code = json.loads(return_url)["redirectUrl"].split( "https://accounts.epicgames.com/fnauth?code=") log.info("Spinning Up Temporary Client...") client = fortnitepy.Client(auth=fortnitepy.AdvancedAuth( email=email, password=password, authorization_code=authorization_code)) @client.event async def event_device_auth_generate(details: dict, email: str): global password c = db.cursor() c.execute("""INSERT INTO `accounts` ('email', 'password', 'device_id', 'account_id', 'secret') VALUES ('%s', '%s', '%s', '%s', '%s')""" % (email, password, details["device_id"], details["account_id"], details["secret"])) c.close() log.info("$GREENSaved Device Details! Shutting Down...") @client.event
def store_detalles_autentificacion(email, details): existing = get_detalles_autentificacion() existing[email] = details with open('auths.json', 'w') as fp: json.dump(existing, fp, sort_keys=False, indent=4) device_auth_details = get_detalles_autentificacion().get(config["correo"], {}) client = fortnitepy.Client( auth=fortnitepy.AdvancedAuth(email=config["correo"], password=config["contraseña"], prompt_authorization_code=True, delete_existing_device_auths=False, **device_auth_details), status=config["estado"], platform=plataforma, avatar=fortnitepy.Avatar(asset=config["kairos_avatar_id"], background_colors=config["kairos_avatar_fondo"])) #Eventos y comandos @client.event async def event_device_auth_generate(details: dict, email: str) -> None: store_detalles_autentificacion(email, details) @client.event async def event_ready(): print(color.BLUE + f"[{getTiempesito()}] ¡El bot se incició exitosamente!")
import asyncio import Config import json import MultipleClients import fortnitepy import sys import io import zipfile import requests from sanic import Sanic,response from Fortnite import DefaultCosmetics from Fortnite.Event import friends,party,message app = Sanic('EasyFNLobbyBot') fnClient = fortnitepy.Client(email=None,password=None) ClientSettings = Config.ConfigReader(json.loads(open("Settings.json").read())) fnClient.Clients = {} fnClient.randomizing = False fnClient.RemovingFriends = False @fnClient.event async def event_ready(): print("Fortnite Client is now ready!") fnClient.mainID = fnClient.user.id fnClient.SubAccountCount = len([Email for Email in fnClient.Settings.Account.Sub_Accounts if "@" in Email]) if fnClient.SubAccountCount > 0: tasks = [] for email,password in fnClient.Settings.Account.Sub_Accounts.items(): if "@" in email and len(tasks) < 10: tasks.append(MultipleClients.LoadAccount(fnClient,email,password))
logger.addHandler(handler) 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 = fortnitepy.Client(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( f'[PartyBot] [{time()}] Client ready as {client.user.display_name}.'
import fortnitepy from discord.ext import commands discord_bot = commands.Bot( command_prefix='!', description='My discord + fortnite bot!', case_insensitive=True ) fortnite_client = fortnitepy.Client( email='email', password='******', loop=discord_bot.loop ) @discord_bot.event async def on_ready(): print('Discord bot ready') await fortnite_client.start() @fortnite_client.event async def event_ready(): print('Fortnite client ready') @discord_bot.event async def on_message(message): print('Received message from {0.author.display_name} | Content "{0.content}"'.format(message)) @fortnite_client.event async def event_friend_message(message): print('Received message from {0.author.display_name} | Content "{0.content}"'.format(message))
# Client # client = fortnitepy.Client( auth=fortnitepy.AdvancedAuth(email=config['Email'], password=config['Password'], **config['Authorization']), status=config['Status'], platform=fortnitepy.Platform(config['Platform']), default_party_member_config=fortnitepy.DefaultPartyMemberConfig( yield_leadership=config['Yield Leadership'], meta=[ partial(fortnitepy.ClientPartyMember.set_outfit, config['Cosmetics']['Outfit']), partial(fortnitepy.ClientPartyMember.set_backpack, config['Cosmetics']['Back Bling']), partial(fortnitepy.ClientPartyMember.set_pickaxe, config['Cosmetics']['Harvesting Tool']), partial(fortnitepy.ClientPartyMember.set_banner, config['Cosmetics']['Banner']['Design'], config['Cosmetics']['Banner']['Color'], config['Cosmetics']['Banner']['Season Level']), partial(fortnitepy.ClientPartyMember.set_battlepass_info, config['Cosmetics']['Battle Pass']['Has Purchased'], config['Cosmetics']['Battle Pass']['Level'], config['Cosmetics']['Battle Pass']['XP Boost Self'], config['Cosmetics']['Battle Pass']['XP Boost Others']) ])) @client.event
elif data['plataforma'].lower() in ["and", "android"]: plataforma = fortnitepy.Platform.ANDROID else: plataforma = fortnitepy.Platform.SWITCH print(Fore.BLACK + Back.YELLOW + f"[{getTiempesito()}] [ADVERTENCIA] {data['plataforma']} no es una plataforma válida.") print(Fore.BLACK + Back.YELLOW + f"[{getTiempesito()}] [ADVERTENCIA] Se ha puesto la plataforma en SWITCH") print(plataforma) client = fortnitepy.Client( auth=fortnitepy.AdvancedAuth( email=data['correo'], password=data['contrasena'], prompt_exchange_code=True, delete_existing_device_auths=True, **device_auth_details ), status=data['estado'], platform=plataforma, default_party_config={'privacy': privasidad}, default_party_member_config=[ functools.partial(fortnitepy.ClientPartyMember.set_outfit, asset=data['skin_id']), functools.partial(fortnitepy.ClientPartyMember.set_backpack, data['mochila_id']), functools.partial(fortnitepy.ClientPartyMember.set_banner, icon=data['escudo'], color=data['escudo_color'], season_level=data['nivel_pase']), ] ) @client.event async def event_device_auth_generate(details: dict, email: str) -> None: store_detalles_autentificacion(email, details) @client.event
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) else: pass client = fortnitepy.Client( email=data['email'], password=data['password'], status=data['status'], platform=fortnitepy.Platform(data['platform']), default_party_member_config=[ functools.partial(fortnitepy.ClientPartyMember.set_outfit, data['cid']), functools.partial(fortnitepy.ClientPartyMember.set_backpack, data['bid']), functools.partial(fortnitepy.ClientPartyMember.set_banner, icon=data['banner'], color=data['banner_colour'], season_level=data['level']), functools.partial(fortnitepy.ClientPartyMember.set_emote, data['eid']), functools.partial(fortnitepy.ClientPartyMember.set_battlepass_info, has_purchased=True, level=data['bp_tier'], self_boost_xp='0', friend_boost_xp='0') ] ) @client.event async def event_ready(): print(crayons.green(f'[PartyBot] [{time()}] Client ready as {client.user.display_name}.')) for pending in client.pending_friends: friend = await pending.accept() if data["friendaccept"] else await pending.decline() if isinstance(friend, fortnitepy.Friend): print(f"[PartyBot] [{time()}] Accepted friend request from: {friend.display_name}.")
passwordjson = data[0]['password'] netcljson = data[0]['netcl'] cid = data[0]['cid'] bid = data[0]['bid'] eid = data[0]['eid'] banner = data[0]['banner'] banner_colour = data[0]['banner_colour'] level = data[0]['level'] bp_tier = data[0]['bp_tier'] self_xp_boost = data[0]['self_xp_boost'] friend_xp_boost = data[0]['friend_xp_boost'] friendaccept = data[0]['friendaccept'] client = fortnitepy.Client( email=emailjson, password=passwordjson, net_cl=netcljson, ) BEN_BOT_BASE = 'http://benbotfn.tk:8080/api/cosmetics/search/multiple' print( 'fortnitepy-bot made by xMistt. credit to Terbau for creating the library.' .format(client)) @client.event async def event_ready(): print('Client ready as {0.user.display_name}'.format(client))
clients = [] device_auths = get_device_auth_details() for email, password in credentials.items(): authentication = fortnitepy.AdvancedAuth( email=email, password=password, prompt_authorization_code=True, prompt_code_if_invalid=True, delete_existing_device_auths=True, **device_auths.get(email, {}) ) client = fortnitepy.Client( auth=authentication, default_party_member_config=fortnitepy.DefaultPartyMemberConfig( meta=( functools.partial(fortnitepy.ClientPartyMember.set_outfit, 'CID_175_Athena_Commando_M_Celestial'), # galaxy skin ) ) ) # register events here client.add_event_handler('device_auth_generate', event_sub_device_auth_generate) client.add_event_handler('friend_request', event_sub_friend_request) client.add_event_handler('party_member_join', event_sub_party_member_join) clients.append(client) fortnitepy.run_multiple( clients, ready_callback=event_sub_ready, all_ready_callback=lambda: print('All clients ready')
elif mode == 'info': 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,
try: import fortnitepy, asyncio, aiofiles from termcolor import colored from flask import Flask except: os.system("pip3 install --user -r requirements.txt") Settings = json.loads(open("Settings.json").read()) Languages = [ "ar", "de", "es-419", "es", "en", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-Hant" ] fortniteClient = fortnitepy.Client( email=Settings["Email"], password=Settings["Password"], status= "Join my Discord\nIf you want your own bot\nhttps://discord.gg/jxgZH6Z\nOr Follow me on Twitter\n@LupusLeaks" ) fortniteClient.Settings = Settings fortniteClient.Clients = {} fortniteClient.RemovingFriends = False default_party_member = [] default_party = {} #Default language if Settings["Default item search language"] in Languages: fortniteClient.DefaultLang = Settings[ "Default item search language"].lower() else: print( f'ERROR: Couldn\'t find {Settings["DefaultItemSearchLanguage"]} as a language'
existing[email] = details with open('auths.json', 'w') as fp: json.dump(existing, fp) device_auth_details = get_device_auth_details().get(data['email'], {}) client = fortnitepy.Client( 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']), default_party_member_config=[ functools.partial(fortnitepy.ClientPartyMember.set_outfit, asset=data['cid']), functools.partial(fortnitepy.ClientPartyMember.set_backpack, data['bid']), functools.partial(fortnitepy.ClientPartyMember.set_banner, icon=data['banner'], color=data['banner_colour'], season_level=data['level']), functools.partial(fortnitepy.ClientPartyMember.set_emote, data['eid']), functools.partial(fortnitepy.ClientPartyMember.set_pickaxe, data['pid']), functools.partial(fortnitepy.ClientPartyMember.set_battlepass_info, has_purchased=True, level=data['bp_tier'], self_boost_xp='0', friend_boost_xp='0') ] ) @client.event async def event_device_auth_geenerate(details, email): store_device_auth_details(email, details) @client.event
else: print("[" + client.user.display_name + "] >> Error claiming the daily reward!") except: print("[" + client.user.display_name + "] >> Something went wrong claiming the daily reward!") pass clients = [] for email, password in credentials.items(): device_auths = get_device_auth_details().get(email, {}) authentication = fortnitepy.AdvancedAuth( email=email, password=password, prompt_authorization_code=True, delete_existing_device_auths=True, **device_auths ) client = fortnitepy.Client(auth=authentication) client.add_event_handler('device_auth_generate', event_sub_device_auth_generate) clients.append(client) fortnitepy.run_multiple( clients, ready_callback=event_sub_ready, all_ready_callback=lambda: Claimer() )