async def cleanup(self): if self.is_ready(): for f in self.friends: await f.remove() for r in self.pending_friends: if type(r) == fortnitepy.IncomingPendingFriend: await r.decline() elif type(r) == fortnitepy.OutgoingPendingFriend: await r.cancel() await self.set_presence( "Battle Royale Lobby - {party_size} / {party_max_size}") await self.party.me.edit_and_keep( partial(self.party.me.set_outfit, "CID_565_Athena_Commando_F_RockClimber"), partial(self.party.me.set_backpack, "BID_122_HalloweenTomato"), partial( self.party.me.set_banner, icon="BRSkirmishBushBandits", color="defaultcolor18", season_level=1337, ), ) self.set_avatar( fortnitepy.Avatar( asset="CID_565_Athena_Commando_F_RockClimber", background_colors=["7c0dc8", "b521cc", "ed34d0"], ))
async def event_ready(): cprint("[Client] Ready as " + client.user.display_name, "green") client.set_avatar( fortnitepy.Avatar(asset="CID_565_Athena_Commando_F_RockClimber", background_colors=["7c0dc8", "b521cc", "ed34d0"])) cosmetics = config['Cosmetics'] if cosmetics['Outfit'] != "": await client.party.me.edit_and_keep( partial(client.party.me.set_outfit, cosmetics['Outfit'])) if cosmetics['Back Bling'] != "": await client.party.me.edit_and_keep( partial(client.party.me.set_backpack, cosmetics['Back Bling'])) if cosmetics['Harvesting Tool'] != "": await client.party.me.edit_and_keep( partial(client.party.me.set_pickaxe, cosmetics['Harvesting Tool'])) if cosmetics['Banner'] is not None: await client.party.me.edit_and_keep( partial(client.party.me.set_banner, icon=cosmetics['Banner']['Design'], color=cosmetics['Banner']['Color'], season_level=cosmetics['Banner']['Season Level'])) if cosmetics['Battle Pass'] is not None: await client.party.me.edit_and_keep( partial( client.party.me.set_battlepass_info, has_purchased=cosmetics['Battle Pass']['Has Purchased'], level=cosmetics['Battle Pass']['Level'], self_boost_xp=cosmetics['Battle Pass']['XP Boost Self'], friend_boost_xp=cosmetics['Battle Pass']['XP Boost Others'])) if config['Accept Friend Requests']: for f in list(client.pending_friends.values()): if f.direction == "INBOUND": await f.accept()
async def start(client, timeout: float): loop = asyncio.get_running_loop() client.task = loop.create_task(client.start()) try: await asyncio.wait_for(client.wait_until_ready(), timeout=timeout) except asyncio.TimeoutError: client.task.cancel() del client.task return False else: for f in list(client.friends.values()): await f.remove() for f in list(client.pending_friends.values()): await f.decline() await client.party.me.edit_and_keep( partial(client.party.me.set_outfit, "CID_565_Athena_Commando_F_RockClimber"), partial(client.party.me.set_backpack, "BID_122_HalloweenTomato"), partial(client.party.me.set_banner, icon="otherbanner31", color="defaultcolor3", season_level=1337)) client.set_avatar( fortnitepy.Avatar(asset="CID_565_Athena_Commando_F_RockClimber", background_colors=["7c0dc8", "b521cc", "ed34d0"])) return True
async def event_ready(): os.system("cls||clear") print(intro) print(Fore.LIGHTBLUE_EX + " • " + Fore.RESET + "Client is called " + Fore.LIGHTBLUE_EX + f"{client.user.display_name}") member = client.party.me await member.edit_and_keep( partial(fortnitepy.ClientPartyMember.set_outfit, asset=data["cid"]), partial(fortnitepy.ClientPartyMember.set_backpack, asset=data["bid"]), partial(fortnitepy.ClientPartyMember.set_pickaxe, asset=data["pid"]), partial( fortnitepy.ClientPartyMember.set_banner, icon=data["banner"], color=data["banner_color"], season_level=data["level"], ), partial( fortnitepy.ClientPartyMember.set_battlepass_info, has_purchased=True, level=data["bp_tier"], ), ) client.set_avatar( fortnitepy.Avatar(asset=data["avatar"], background_colors=["#ffffff", "#2E8B57", "#7FFF00"]))
def __init__(self, settings: BotSettings, device_auths: DeviceAuths) -> None: self.device_auths = device_auths self.settings = settings self.fortnite_api = FortniteAPIAsync.APIClient() account_device_auths = self.device_auths.get_device_auth( email=settings.email) super().__init__( command_prefix='!', auth=fortnitepy.AdvancedAuth( email=self.settings.email, password=self.settings.password, prompt_authorization_code=True, delete_existing_device_auths=True, device_id=account_device_auths.device_id, account_id=account_device_auths.account_id, secret=account_device_auths.secret), status=self.settings.status, platform=fortnitepy.Platform(self.settings.platform), avatar=fortnitepy.Avatar(asset=self.settings.cid, background_colors=fortnitepy. KairosBackgroundColorPreset.PINK.value)) self.message = f'[PartyBot] [{datetime.datetime.now().strftime("%H:%M:%S")}] %s'
async def avatar(self, ctx: fortnitepy.ext.commands.Context, kairos_cid: str) -> None: kairos_avatar = fortnitepy.Avatar(asset=kairos_cid) self.bot.set_avatar(kairos_avatar) await ctx.send(f'Kairos avatar set to {kairos_cid}.') print(self.bot.message % f'Kairos avatar set to {kairos_cid}.')
async def avatar(ctx: fortnitepy.ext.commands.Context, kairos_cid: str) -> None: kairos_avatar = fortnitepy.Avatar(asset=kairos_cid) client.set_avatar(kairos_avatar) await ctx.send(f'Kairos avatar set to {kairos_cid}.') print(f'[PartyBot] [{time()}] Kairos avatar set to {kairos_cid}.')
def __init__(self, settings: BotSettings, loop: asyncio.AbstractEventLoop) -> None: self.settings = settings device_auth_details = self.get_device_auth_details().get( self.settings.email, {}) super().__init__( command_prefix='!', status=self.settings.status, platform=fortnitepy.Platform(self.settings.platform), avatar=fortnitepy.Avatar(asset=self.settings.cid, background_colors=fortnitepy. KairosBackgroundColorPreset.PINK.value), auth=fortnitepy.AdvancedAuth(email=self.settings.email, password=self.settings.password, prompt_authorization_code=True, delete_existing_device_auths=True, **device_auth_details)) self.message = f'[PartyBot] {get_time()} %s'
async def event_ready(self): await self.refresh_status() for f in list(self.pending_friends.values()): if type(f) == fortnitepy.IncomingPendingFriend: await f.accept() await self.party.me.edit_and_keep( partial(self.party.me.set_outfit, "CID_565_Athena_Commando_F_RockClimber"), partial(self.party.me.set_backpack, "BID_122_HalloweenTomato"), partial(self.party.me.set_banner, icon="otherbanner31", color="defaultcolor3", season_level=1337)) self.set_avatar( fortnitepy.Avatar(asset="CID_565_Athena_Commando_F_RockClimber", background_colors=["7c0dc8", "b521cc", "ed34d0"])) self.add_event_handler("event_party_member_join", self.refresh_status) self.add_event_handler("event_party_member_leave", self.refresh_status)
async def event_ready(self): # Get the current account alias for cname in self.config: if self.config[cname].get("email", "") == self.client.user.email: break defaults = self.config[cname]["Cosmetics"] # Set the defaults for the alias await self.client.party.me.edit_and_keep( partial( self.client.party.me.set_outfit, defaults.get("Outfit", "CID_565_Athena_Commando_F_RockClimber")), partial(self.client.party.me.set_backpack, defaults.get("Backbling", "BID_122_HalloweenTomato")), partial( self.client.party.me.set_pickaxe, defaults.get("Harvesting Tool", "Pickaxe_ID_263_JonesyCube")), partial(self.client.party.me.set_banner, icon=defaults.get("Banner", {}).get("Icon"), color=defaults.get("Banner", {}).get("Color"), season_level=defaults.get("Banner", {}).get("Season Level")), partial(self.client.party.me.set_battlepass_info, has_purchased=defaults.get("Battle Pass", {}).get("Has Purchased"), level=defaults.get("Battle Pass", {}).get("Level"), self_boost_xp=defaults.get("Battle Pass", {}).get("Self Boost XP"), friend_boost_xp=defaults.get("Battle Pass", {}).get("Friend Boost XP"))) self.client.set_avatar( fortnitepy.Avatar(asset=defaults.get("Avatar"), background_colors=["7c0dc8", "b521cc", "ed34d0"])) # Print message in log that we are ready self.log.info( f"$GREENLogged in $MAGENTA{cname} $GREENas $CYAN{self.client.user.display_name}$GREEN." )
async def start_bot(member: discord.Member, time: int): try: message = await member.send( embed=discord.Embed( title="<a:Loading:719025775042494505> Starting Bot...", type="rich", color=0x7289da ) ) except discord.Forbidden: return if member.id in list(owner.keys()): await message.edit( embed=discord.Embed( title=":x: Bot Already Running!", color=0xe46b6b ), delete_after=3 ) return else: name = random.choice(list(available.keys())) client = available[name] available.pop(name) owner[member.id] = client messages[client] = message @client.event async def event_friend_request(friend: fortnitepy.PendingFriend): if friend.direction != "INBOUND": return rmsg = await member.send( embed=discord.Embed( title="<:FriendRequest:719042256849338429> Friend Request from " + friend.display_name, type="rich", description="<:Accept:719047548219949136> Accept <:Reject:719047548819472446> Reject" ) ) await rmsg.add_reaction(":Accept:719047548219949136") await rmsg.add_reaction(":Reject:719047548819472446") def check(reaction, user): if str(reaction.emoji) in ["<:Accept:719047548219949136>", "<:Reject:719047548819472446>"] and not user.bot: return True else: return False try: reaction, user = await dclient.wait_for("reaction_add", timeout=60.0, check=check) except asyncio.exceptions.TimeoutError: await friend.decline() await rmsg.edit( delete_after=1, embed=discord.Embed( title="<:FriendRequest:719042256849338429> Friend Request from " + friend.display_name, type="rich", color=0xf24949 ) ) else: if str(reaction.emoji) == "<:Accept:719047548219949136>": await friend.accept() await rmsg.edit( delete_after=1, embed=discord.Embed( title="<:FriendRequest:719042256849338429> Friend Request from " + friend.display_name, type="rich", color=0x43b581 ) ) elif str(reaction.emoji) == "<:Reject:719047548819472446>": await friend.decline() await rmsg.edit( delete_after=1, embed=discord.Embed( title="<:FriendRequest:719042256849338429> Friend Request from " + friend.display_name, type="rich", color=0xf24949 ) ) @client.event async def event_party_invite(invitation: fortnitepy.ReceivedPartyInvitation): rmsg = await member.send( embed=discord.Embed( title="<:PartyInvite:719198827281645630> Party Invite from " + invitation.sender.display_name, type="rich", description="<:Accept:719047548219949136> Accept <:Reject:719047548819472446> Reject" ) ) await rmsg.add_reaction(":Accept:719047548219949136") await rmsg.add_reaction(":Reject:719047548819472446") def check(reaction, user): if str(reaction.emoji) in ["<:Accept:719047548219949136>", "<:Reject:719047548819472446>"] and not user.bot: return True else: return False try: reaction, user = await dclient.wait_for("reaction_add", timeout=60.0, check=check) except asyncio.exceptions.TimeoutError: await invitation.decline() await rmsg.edit( delete_after=1, embed=discord.Embed( title="<:PartyInvite:719198827281645630> Party Invite from " + invitation.sender.display_name, type="rich", color=0xf24949 ) ) else: if str(reaction.emoji) == "<:Accept:719047548219949136>": await invitation.accept() await rmsg.edit( delete_after=1, embed=discord.Embed( title="<:PartyInvite:719198827281645630> Party Invite from " + invitation.sender.display_name, type="rich", color=0x43b581 ) ) elif str(reaction.emoji) == "<:Reject:719047548819472446>": await invitation.decline() await rmsg.edit( delete_after=1, embed=discord.Embed( title="<:PartyInvite:719198827281645630> Party Invite from " + invitation.sender.display_name, type="rich", color=0xf24949 ) ) loop.create_task(client.start()) await client.wait_until_ready() for f in list(client.friends.values()): await f.remove() for f in list(client.pending_friends.values()): await f.decline() await client.party.me.edit_and_keep( partial(client.party.me.set_outfit, "CID_565_Athena_Commando_F_RockClimber"), partial(client.party.me.set_backpack, "BID_122_HalloweenTomato"), partial(client.party.me.set_banner, icon="otherbanner31", color="defaultcolor3", season_level=1337) ) client.set_avatar( fortnitepy.Avatar( asset="CID_565_Athena_Commando_F_RockClimber", background_colors=[ "7c0dc8", "b521cc", "ed34d0" ] ) ) await message.edit( embed=discord.Embed( title="<:Online:719038976677380138> " + client.user.display_name, type="rich", color=0xfc5fe2 ).set_thumbnail( url=get_cosmetic_by_id(client.party.me.outfit)['icons']['icon'] ) ) hook.send(":heavy_plus_sign: " + member.mention + " is now using the bot (" + client.user.display_name + ")") await message.channel.send(content="Documentation is available here: **<https://aerial.now.sh/>**", delete_after=120) tasks[client] = loop.call_later( time, loop.create_task, stop_bot( client, member.id, "This bot automatically shuts down after 90 minutes." ) )
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
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!") print( color.BLUE + "\n---------------------------------------------------------------------" )