Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def copy(ctx: fortnitepy.ext.commands.Context, *, epic_username: Union[str, None] = None) -> None:
if epic_username is None:
member = client.party.members.get(ctx.author.id)
else:
user = await client.fetch_profile(epic_username)
member = client.party.members.get(user.id)
await client.party.me.edit(
functools.partial(
fortnitepy.ClientPartyMember.set_outfit,
asset=member.outfit,
variants=member.outfit_variants
),
functools.partial(
fortnitepy.ClientPartyMember.set_backpack,
asset=member.backpack,
variants=member.backpack_variants
),
functools.partial(
fortnitepy.ClientPartyMember.set_pickaxe,
asset=member.pickaxe,
variants=member.pickaxe_variants
),
functools.partial(
fortnitepy.ClientPartyMember.set_banner,
icon=member.banner[0],
user = await client.fetch_profile(epic_username)
member = client.party.members.get(user.id)
await client.party.me.edit(
functools.partial(
fortnitepy.ClientPartyMember.set_outfit,
asset=member.outfit,
variants=member.outfit_variants
),
functools.partial(
fortnitepy.ClientPartyMember.set_backpack,
asset=member.backpack,
variants=member.backpack_variants
),
functools.partial(
fortnitepy.ClientPartyMember.set_pickaxe,
asset=member.pickaxe,
variants=member.pickaxe_variants
),
functools.partial(
fortnitepy.ClientPartyMember.set_banner,
icon=member.banner[0],
color=member.banner[1],
season_level=member.banner[2]
),
functools.partial(
fortnitepy.ClientPartyMember.set_battlepass_info,
has_purchased=True,
level=member.battlepass_info[1]
)
)
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,
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')
async def lobby(ctx: fortnitepy.ext.commands.Context) -> None:
if client.default_party_member_config.cls == fortnitepy.JustChattingClientPartyMember:
client.default_party_member_config.cls = fortnitepy.ClientPartyMember
party_id = client.party.id
await client.party.me.leave()
await ctx.send('Removed state of Just Chattin\'. Now attempting to rejoin party.')
try:
await client.join_to_party(party_id)
except fortnitepy.errors.Forbidden:
await ctx.send('Failed to join back as party is set to private.')
except fortnitepy.errors.NotFound:
await ctx.send('Party not found, are you sure Fortnite is open?')
await client.party.me.clear_in_match()
await ctx.send('Set state to the pre-game lobby.')
clients = []
device_auths = get_device_auth_details()
for email, password in credentials.items():
authentication = fortnitepy.AdvancedAuth(
email=email,
password=password,
prompt_authorization_code=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')
)