Exemplo n.º 1
0
    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'
Exemplo n.º 2
0
 def __init__(self):
     device_auth_details = self.get_device_auth_details().get(email, {})
     super().__init__(auth=fortnitepy.AdvancedAuth(
         email=email,
         password=password,
         prompt_authorization_code=True,
         delete_existing_device_auths=True,
         **device_auth_details),
                      platform=fortnitepy.Platform(data["platform"]))
Exemplo n.º 3
0
    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))
Exemplo n.º 4
0
 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'
Exemplo n.º 5
0
async def event_friend_message(message):
    args = message.content.split()
    split = args[1:]
    joinedArguments = " ".join(split)
    print(' [RenegadeFN] [' + getTime() + '] {0.author.display_name}: {0.content}'.format(message))

    if "!skin" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            try:
                cosmetic = await BenBotAsync.get_cosmetic(
                    lang="en",
                    searchLang="en",
                    matchMethod="contains",
                    name=joinedArguments,
                    backendType="AthenaCharacter"
                )
                await client.user.party.me.set_outfit(asset=cosmetic.id)
                await message.reply('Skin set to ' + f'{joinedArguments}')
            except BenBotAsync.exceptions.NotFound:
                await message.reply(f'Could not find a skin named: {joinedArguments}')
                
        
    if "!backpack" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            if len(args) == 1:
                await client.user.party.me.set_backpack(asset='none')
                await message.reply('Backpack set to None')
            else:
                try:
                    cosmetic = await BenBotAsync.get_cosmetic(
                        lang="en",
                        searchLang="en",
                        matchMethod="contains",
                        name=joinedArguments,
                        backendType="AthenaBackpack"
                    )
                    await client.user.party.me.set_backpack(asset=cosmetic.id)
                    await message.reply('Backpack set to ' + f'{joinedArguments}')
                except BenBotAsync.exceptions.NotFound:
                    await message.reply(f'Could not find a backpack named: {joinedArguments}')

    if "!emote" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            try:
                cosmetic = await BenBotAsync.get_cosmetic(
                    lang="en",
                    searchLang="en",
                    matchMethod="contains",
                    name=joinedArguments,
                    backendType="AthenaDance"
                )
                await client.user.party.me.clear_emote()
                await client.user.party.me.set_emote(asset=cosmetic.id)
                await message.reply('Emote set to ' + f'{joinedArguments}')
            except BenBotAsync.exceptions.NotFound:
                await message.reply(f'Could not find an emote named: {joinedArguments}')
    
    if "!pickaxe" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            try:
                cosmetic = await BenBotAsync.get_cosmetic(
                    lang="en",
                    searchLang="en",
                    matchMethod="contains",
                    name=joinedArguments,
                    backendType="AthenaPickaxe"
                )
                await client.user.party.me.set_pickaxe(asset=cosmetic.id)
                await message.reply('Pickaxe set to ' + f'{joinedArguments}')
            except BenBotAsync.exceptions.NotFound:
                await message.reply(f'Could not find a pickaxe named: {joinedArguments}')

    if "!point" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await client.user.party.me.clear_emote()
            if len(args) == 1:
                await client.user.party.me.set_emote(asset="/Game/Athena/Items/Cosmetics/Dances/EID_IceKing.EID_IceKing")
                await message.reply('Doing emote: Point It Out')
            else:
                try:
                    cosmetic = await BenBotAsync.get_cosmetic(
                        lang="en",
                        searchLang="en",
                        matchMethod="contains",
                        name=joinedArguments,
                        backendType="AthenaPickaxe"
                    )
                    await client.user.party.me.set_pickaxe(asset=cosmetic.id)
                    await client.user.party.me.clear_emote()
                    await client.user.party.me.set_emote(asset="/Game/Athena/Items/Cosmetics/Dances/EID_IceKing.EID_IceKing")
                    await message.reply('Pointing with ' + f'{joinedArguments}')
                except BenBotAsync.exceptions.NotFound:
                    await message.reply(f'Could not find a pickaxe named: {joinedArguments}')

    if "!pet" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            try:
                cosmetic = await BenBotAsync.get_cosmetic(
                    lang="en",
                    searchLang="en",
                    matchMethod="contains",
                    name=joinedArguments,
                    backendType="AthenaPet"
                )
                await client.user.party.me.set_pet(asset=cosmetic.id)
                await message.reply('Pet set to ' + f'{joinedArguments}')
            except BenBotAsync.exceptions.NotFound:
                await message.reply(f'Could not find a pet named: {joinedArguments}')

    if "!emoji" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            try:
                cosmetic = await BenBotAsync.get_cosmetic(
                    lang="en",
                    searchLang="en",
                    matchMethod="contains",
                    name=joinedArguments,
                    backendType="AthenaEmoji"
                )
                await client.user.party.me.set_emoji(asset=cosmetic.id)
                await message.reply('Emoji set to ' + f'{joinedArguments}')
            except BenBotAsync.exceptions.NotFound:
                await message.reply(f'Could not find an emoji named: {joinedArguments}')

    if "!purpleskull" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            try:
                variants = client.user.party.me.create_variants(
                   clothing_color=1
                )

                await client.user.party.me.set_outfit(
                    asset='CID_030_Athena_Commando_M_Halloween',
                    variants=variants
                )

                await message.reply('Skin set to Purple Skull Trooper!')
                print(f" [RenegadeFN] [{getTime()}] Client's Skin set to Purple Skull Trooper")
            except Exception as e:
                pass

    if "!pinkghoul" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            try:
                variants = client.user.party.me.create_variants(
                   material=3
                )

                await client.user.party.me.set_outfit(
                    asset='CID_029_Athena_Commando_F_Halloween',
                    variants=variants
                )

                await message.reply('Skin set to Pink Ghoul Trooper!')
                print(f" [RenegadeFN] [{getTime()}] Client's Skin set to Pink Ghoul Trooper")
            except Exception as e:
                pass
               
    if "!goldpeely" in args[0].lower():
        await client.user.party.me.set_outfit(
            asset='CID_701_Athena_Commando_M_BananaAgent',
            variants=client.user.party.me.create_variants(
                progressive=4
                ),
            enlightenment=(2, 350)
        )

        await message.reply(f'Skin set to Golden Peely')

    if "!brainiacghoul" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            try:
                variants = client.user.party.me.create_variants(
                   material=2
                )

                await client.user.party.me.set_outfit(
                    asset='CID_029_Athena_Commando_F_Halloween',
                    variants=variants
                )

                await message.reply('Skin set to Brainiac Ghoul Trooper!')
                print(f" [RenegadeFN] [{getTime()}] Client's Skin set to Brainiac Ghoul Trooper")
            except Exception as e:
                pass

    if "!purpleportal" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            variants = client.user.party.me.create_variants(
                item='AthenaBackpack',
                particle_config='Particle',
                particle=1
            )

            await client.user.party.me.set_backpack(
                asset='BID_105_GhostPortal',
                variants=variants
            )

            await message.reply('Backpack set to Purple Ghost Portal!')
            print(f" [RenegadeFN] [{getTime()}] Client's Backpack set to Purple Ghost Portal")

    if "!banner" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            if len(args) == 1:
                await message.reply('You need to specify which banner, color & level you want to set the banner as.')
            if len(args) == 2:
                await client.user.party.me.set_banner(icon=args[1], color=data['banner_colour'], season_level=data['level'])
            if len(args) == 3:
                await client.user.party.me.set_banner(icon=args[1], color=args[2], season_level=data['level'])
            if len(args) == 4:
                await client.user.party.me.set_banner(icon=args[1], color=args[2], season_level=args[3])

            await message.reply(f'Banner set to; {args[1]} {args[2]} {args[3]}')
            print(f" [RenegadeFN] [{getTime()}] Banner set to; {args[1]} {args[2]} {args[3]}")

    if "CID_" in args[0]:
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await client.user.party.me.set_outfit(
                asset=args[0]
            )
            await message.reply(f'Skin set to {args[0]}')
            print(f' [RenegadeFN] [{getTime()}] Skin set to ' + args[0])

    if "!variants" in args[0]:
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            args3 = int(args[3])

            if 'CID' in args[1]:
                variants = client.user.party.me.create_variants(**{args[2]: args3})
                await client.user.party.me.set_outfit(
                    asset=args[1],
                    variants=variants
                )
            elif 'BID' in args[1]:
                variants = client.user.party.me.create_variants(item='AthenaBackpack', **{args[2]: args3})
                await client.user.party.me.set_backpack(
                    asset=args[1],
                    variants=variants
                )
            elif 'PICKAXE_ID' in args[1]:
                variants = client.user.party.me.create_variants(item='AthenaPickaxe', **{args[2]: args3})
                await client.user.party.me.set_pickaxe(
                    asset=args[1],
                    variants=variants
                )

            await message.reply(f'Set variants of {args[1]} to {args[2]} {args[3]}.')
            print(f' [RenegadeFN] [{getTime()}] Set variants of {args[1]} to {args[2]} {args[3]}.')

    if "!checkeredrenegade" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            variants = client.user.party.me.create_variants(
               material=2
            )

            await client.user.party.me.set_outfit(
                asset='CID_028_Athena_Commando_F',
                variants=variants
            )

            await message.reply('Skin set to Checkered Renegade!')
            print(f" [RenegadeFN] [{getTime()}] Client's Skin set to Checkered Renegade")

    if "!mintyelf" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            variants = client.user.party.me.create_variants(
                   material=2
                )

            await client.user.party.me.set_outfit(
                asset='CID_051_Athena_Commando_M_HolidayElf',
                variants=variants
                )

            await message.reply('Skin set to Minty Elf!')
            print(f" [RenegadeFN] [{getTime()}] Client's Skin set to Minty Elf")

    if "EID_" in args[0]:
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await client.user.party.me.clear_emote()
            await client.user.party.me.set_emote(
                asset=args[0]
            )
            await message.reply('Emote set to ' + args[0] + '!')
        
    if "!stop" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await client.user.party.me.clear_emote()
            await message.reply('Stopped emoting.')

    if "BID_" in args[0]:
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await client.user.party.me.set_backpack(
                asset=args[0]
            )

            await message.reply('Backbling set to ' + message.content + '!')

    if "help" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await message.reply('List of all commands coming soon.')

    if "Pickaxe_" in args[0]:
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await client.user.party.me.set_pickaxe(
                    asset=args[0]
            )

            await message.reply('Pickaxe set to ' + args[0] + '!')

    if "PetCarrier_" in args[0]:
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await client.user.party.me.set_backpack(
                    asset="/Game/Athena/Items/Cosmetics/PetCarriers/" + args[0] + "." + args[0]
            )

    if "Emoji_" in args[0]:
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await client.user.party.me.set_emote(asset='EID_ClearEmote')
            await client.user.party.me.set_emote(
                    asset="/Game/Athena/Items/Cosmetics/Dances/Emoji/" + args[0] + "." + args[0]
            )

    if "!ready" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await client.user.party.me.set_ready(fortnitepy.ReadyState.READY)
            await message.reply('Now Ready!')

    if ("!unready" in args[0].lower()) or ("!sitin" in args[0].lower()):
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await client.user.party.me.set_ready(fortnitepy.ReadyState.NOT_READY)
            await message.reply('Now Unready!')

    if "!sitout" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await client.user.party.me.set_ready(fortnitepy.ReadyState.SITTING_OUT)
            await message.reply('Now Sitting Out!')

    if "!bp" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await client.user.party.me.set_battlepass_info(has_purchased=True, level=args[1], self_boost_xp='0', friend_boost_xp='0')

    if "!level" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            await client.user.party.me.set_banner(icon=client.user.party.me.banner[0], color=client.user.party.me.banner[1], season_level=args[1])
    
    if "!reset" in args[0].lower():
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            variants = client.user.party.me.create_variants(**{data['variants-type']: data['variants']})
            await client.user.party.me.set_outfit(asset=data['cid'], variants=variants)
            await client.user.party.me.set_backpack(asset=data['bid'])
            await client.user.party.me.set_banner(icon=data['banner'], color=data['banner_colour'], season_level=data['level'])
            await client.user.party.me.set_pickaxe(asset=data['pid'])
            await client.user.party.me.set_battlepass_info(has_purchased=True, level=data['bp_tier'], self_boost_xp='0', friend_boost_xp='0')
            await message.reply(f"Reset to default cosmetic loadout.")

    if "!echo" in args[0].lower():
        if message.author.display_name in data['FullAccess']:
            await client.user.party.send(joinedArguments)
            print(f' [RenegadeFN] [{getTime()}] ' + color.GREEN + 'Sent Message:' + color.END + f' {joinedArguments}')
        else:
            if message.author.display_name not in data['FullAccess']:
                await message.reply(f"You don't have access to this command!")

    if "!admin" in args[0].lower():
        if message.author.display_name in data['FullAccess']:
            if len(args) == 1:
                await message.reply('Please specify if you want to add or remove a user from the admin list')
                print(f' [RenegadeFN] [{getTime()}] Please specify if you want to add or remove a user from the admin list, using ' + color.GREEN + '!admin add ' + color.END + 'or ' + color.GREEN + '!admin remove' + color.END)
            if len(args) == 2:
                if args[1].lower() == 'add' or args[1].lower() == 'remove':
                    await message.reply('Please specify the name of the user you want to add/remove from the admin list')
                    print(f' [RenegadeFN] [{getTime()}] Please specify the name of the user you want to add/remove from the admin list')
                else:
                    await message.reply('Invalid usage, try !admin add <username> or !admin remove <username>')
                    print(f' [RenegadeFN] [{getTime()}] Invalid usage, try ' + color.GREEN + '!admin add <username> ' + color.END + 'or ' + color.GREEN + '!admin remove <username>' + color.END)
            if len(args) >= 3:
                joinedArgumentsAdmin = " ".join(args[2:])
                user = await client.fetch_profile(joinedArgumentsAdmin)
                try:
                    if args[1].lower() == 'add':
                        if user.display_name not in data['FullAccess']:
                            data['FullAccess'].append(f"{user.display_name}")
                            with open('config.json', 'w') as f:
                                json.dump(data, f, indent=4)
                                print(f" [RenegadeFN] [{getTime()}] Added " + color.GREEN + f"{user.display_name}" + color.END + " as an admin")
                        elif user.display_name in data['FullAccess']:               
                            print(f" [RenegadeFN] [{getTime()}]" + color.GREEN + f" {user.display_name}" + color.END + " is already an admin")
                    elif args[1].lower() == 'remove':
                        if user.display_name in data['FullAccess']:
                            data['FullAccess'].remove(user.display_name)
                            with open('config.json', 'w') as f:
                                json.dump(data, f, indent=4)
                                print(f" [RenegadeFN] [{getTime()}] Removed " + color.GREEN + f"{user.display_name}" + color.END + " as an admin")
                        elif user.display_name not in data['FullAccess']:
                            print(f" [RenegadeFN] [{getTime()}]" + color.GREEN + f" {user.display_name}" + color.END + " is not an admin")
                except AttributeError:
                    pass
                    print(f" [RenegadeFN] [{getTime()}] Can't find user: "******"{joinedArgumentsAdmin}" + color.END)
                    await message.reply(f"I couldn't find an Epic account with the name: {joinedArgumentsAdmin}.")
        if message.author.display_name not in data['FullAccess']:
            if len(args) >= 3 and args[1].lower() == 'add':
                await message.reply(f"Password?")
                res = await client.wait_for('friend_message')
                content = res.content.lower()
                joinedArgumentsAdmin = " ".join(args[2:])
                user = await client.fetch_profile(joinedArgumentsAdmin)
                if content in data['AdminPassword']:
                    if user.display_name not in data['FullAccess']:
                        data['FullAccess'].append(f"{user.display_name}")
                        with open('config.json', 'w') as f:
                            json.dump(data, f, indent=4)
                            await message.reply(f"Correct. Added {user.display_name} as an admin.")
                            print(f" [RenegadeFN] [{getTime()}] Added " + color.GREEN + f"{user.display_name}" + color.END + " as an admin")
                    elif user.display_name in data['FullAccess']:
                        print(f" [RenegadeFN] [{getTime()}]" + color.GREEN + f" {user.display_name}" + color.END + " is already an admin")
                        await message.reply(f"{user.display_name} is already an admin.")
            else:
                await message.reply(f"You don't have access to this command!")

    if "!blocklist" in args[0].lower():
        if message.author.display_name in data['FullAccess']:
            if len(args) == 1:
                await message.reply('Please specify if you want to add or remove a user from the block list')
                print(f' [RenegadeFN] [{getTime()}] Please specify if you want to add or remove a user from the admin list, using ' + color.GREEN + '!admin add ' + color.END + 'or ' + color.GREEN + '!admin remove' + color.END)
            if len(args) == 2:
                if args[1].lower() == 'add' or args[1].lower() == 'remove':
                    await message.reply('Please specify the name of the user you want to add/remove from the block list')
                    print(f' [RenegadeFN] [{getTime()}] Please specify the name of the user you want to add/remove from the block list')
                else:
                    await message.reply('Invalid usage, try !blocklist add <username> or !blocklist remove <username>')
                    print(f' [RenegadeFN] [{getTime()}] Invalid usage, try ' + color.GREEN + '!BlockList add <username> ' + color.END + 'or ' + color.GREEN + '!BlockList remove <username>' + color.END)
            if len(args) >= 3:
                joinedArgumentsAdmin = " ".join(args[2:])
                user = await client.fetch_profile(joinedArgumentsAdmin)
                if args[1].lower() == 'add':
                    if user.display_name not in data['FullAccess'] and user.display_name not in data['BlockList']:
                        data['BlockList'].append(f"{user.display_name}")
                        with open('config.json', 'w') as f:
                            json.dump(data, f, indent=4)
                            await message.reply(f"Added {user.display_name} to the blocked list.")
                            print(f" [RenegadeFN] [{getTime()}] Added " + color.GREEN + f"{user.display_name}" + color.END + " to the blocked list.")
                    elif user.display_name in data['FullAccess']:
                        await message.reply(f"{user.display_name} can not be added to the blocked list.")
                        print(f" [RenegadeFN] [{getTime()}]" + color.GREEN + f" {user.display_name}" + color.END + " cannot be added to the blocked list.")
                    elif user.display_name in data['BlockList']:               
                        await message.reply(f"{user.display_name} is already on the blocked list.")
                        print(f" [RenegadeFN] [{getTime()}]" + color.GREEN + f" {user.display_name}" + color.END + " is already on the blocked list.")
                elif args[1].lower() == 'remove':
                    if user.display_name in data['BlockList']:
                        data['BlockList'].remove(user.display_name)
                        with open('config.json', 'w') as f:
                            json.dump(data, f, indent=4)
                            print(f" [RenegadeFN] [{getTime()}] Removed " + color.GREEN + f"{user.display_name}" + color.END + " from the blocked list.")
                    elif user.display_name not in data['BlockList']:
                        print(f" [RenegadeFN] [{getTime()}]" + color.GREEN + f" {user.display_name}" + color.END + " is not on the blocked list.")
        if message.author.display_name not in data['FullAccess']:
            if len(args) >= 3 and args[1].lower() == 'add':
                await message.reply(f"Password?")
                res = await client.wait_for('friend_message')
                content = res.content.lower()
                joinedArgumentsAdmin = " ".join(args[2:])
                user = await client.fetch_profile(joinedArgumentsAdmin)
                if content in data['AdminPassword']:
                    if user.display_name not in data['BlockList']:
                        data['BlockList'].append(f"{user.display_name}")
                        with open('config.json', 'w') as f:
                            json.dump(data, f, indent=4)
                            await message.reply(f"Correct. Added {user.display_name} to the blocked list.")
                            print(f" [RenegadeFN] [{getTime()}] Added " + color.GREEN + f"{user.display_name}" + color.END + " to the blocked list.")
                    elif user.display_name in data['BlockList']:
                        print(f" [RenegadeFN] [{getTime()}]" + color.GREEN + f" {user.display_name}" + color.END + " is already on the blocked list.")
                        await message.reply(f"{user.display_name} is already on the blocked list.")
                elif args[1].lower() == 'remove':
                    await message.reply(f"Password?")
                    res = await client.wait_for('friend_message')
                    content = res.content.lower()
                    joinedArgumentsAdmin = " ".join(args[2:])
                    user = await client.fetch_profile(joinedArgumentsAdmin)
                    if content in data['AdminPassword']:
                        if user.display_name in data['BlockList']:
                            data['BlockList'].remove(user.display_name)
                            with open('config.json', 'w') as f:
                                json.dump(data, f, indent=4)
                                print(f" [RenegadeFN] [{getTime()}] Removed " + color.GREEN + f"{user.display_name}" + color.END + " from the blocked list.")
                        elif user.display_name not in data['BlockList']:
                            print(f" [RenegadeFN] [{getTime()}]" + color.GREEN + f" {user.display_name}" + color.END + " is not on the blocked list.")
            else:
                await message.reply(f"You don't have access to this command!")

    if "!status" in args[0].lower():
        if message.author.display_name in data['FullAccess']:
            await client.set_status(joinedArguments)
            await message.reply(f'Status set to {joinedArguments}')
            print(f' [RenegadeFN] [{getTime()}] Status set to {joinedArguments}.')
        else:
            if message.author.display_name not in data['FullAccess']:
                await message.reply(f"You don't have access to this command!")
            
    if "!leave" in args[0].lower():
        if message.author.display_name in data['FullAccess']:
            await client.user.party.me.set_emote('EID_Snap')
            delay.sleep(2)
            await client.user.party.me.leave()
            await message.reply('Bye!')
            print(Fore.GREEN + f' [RenegadeFN] [{getTime()}] Left the party as I was requested.')
        else:
            if message.author.display_name not in data['FullAccess']:
                await message.reply(f"You don't have access to this command!")

    if "!kick" in args[0].lower() and message.author.display_name in data['FullAccess']:
        user = await client.fetch_profile(joinedArguments)
        member = client.user.party.members.get(user.id)
        if member is None:
            await message.reply("Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.kick()
                await message.reply(f"Kicked user: {member.display_name}.")
                print(Fore.GREEN + f" [RenegadeFN] [{getTime()}] Kicked user: {member.display_name}")
            except Exception as e:
                pass
                await message.reply(f"Couldn't kick {member.display_name}, as I'm not party leader.")
                print(Fore.RED + f" [RenegadeFN] [{getTime()}] [ERROR] Failed to kick member as I don't have the required permissions." + Fore.WHITE)
        if message.author.display_name not in data['FullAccess']:
            await message.reply(f"You don't have access to this command!")

    if "!join" in args[0] and message.author.display_name in data['FullAccess']:
        if len(args) != 1:
            user = await client.fetch_profile(joinedArguments)
            friend = client.get_friend(user.id)
        if len(args) == 1:
            user = await client.fetch_profile(message.author.id, cache=False, raw=False)
            friend = client.get_friend(user.id)
        if friend is None:
            await message.reply(f"Unable to invite that user, are you sure the bot has them added?")
            print(Fore.RED + f" [RenegadeFN] [{getTime()}] [ERROR] Unable to join user: {joinedArguments}, are you sure the bot has them added?" + Fore.WHITE)
        if message.author.display_name not in data['FullAccess']:
            await message.reply(f"You don't have access to this command!")
        else:
            try:
                await friend.join_party()
                await message.reply(f"Joining {friend.display_name}'s party.")
            except Exception as e:
                await message.reply(f"Can not join user's party.")

    if "!invite" in args[0].lower():
        if len(args) != 1:
            user = await client.fetch_profile(joinedArguments)
            friend = client.get_friend(user.id)
        if len(args) == 1:
            user = await client.fetch_profile(message.author.id, cache=False, raw=False)
            friend = client.get_friend(user.id)
        if friend is None:
            await message.reply(f"Unable to invite that user, are you sure the bot has them added?")
            print(Fore.RED + f" [RenegadeFN] [{getTime()}] [ERROR] Unable to invite user: {joinedArguments}, are you sure the bot has them added?" + Fore.WHITE)
        else:
            try:
                await friend.invite()
                await message.reply(f"Invited user: {friend.display_name}.")
                print(Fore.GREEN + f" [RenegadeFN] [{getTime()}] Invited user: {friend.display_name}")
            except Exception as e:
                pass
                await message.reply(f"Something went wrong trying to invite {friend.display_name}")
                print(Fore.RED + f" [RenegadeFN] [{getTime()}] [ERROR] Something went wrong while trying to invite {friend.display_name}" + Fore.WHITE)           

    if "!add" in args[0].lower() and message.author.display_name in data['FullAccess']:
        user = await client.fetch_profile(joinedArguments)
        friends = client.friends
        if user is None:
            await message.reply(f"I can't find a player with the name of {joinedArguments}.")
            print(Fore.RED + f" [RenegadeFN] [{getTime()}] [ERROR] Unable to find a player with the name {joinedArguments}")
        else:
            try:
                if (user.id in friends):
                    await message.reply(f"I already have {user.display_name} as a friend.")
                    print(Fore.RED + f" [RenegadeFN] [{getTime()}] [ERROR] You already have {user.display_name} added as a friend.")
                else: 
                    await client.add_friend(user.id)
                    await message.reply(f"Sent a friend request to {user.display_name}")
                    print(Fore.GREEN + f" [RenegadeFN] [{getTime()}] {client.user.display_name} sent a friend request to {user.display_name}" + Fore.WHITE)
            except Exception as e:
                pass
                print(Fore.RED + f" [RenegadeFN] [{getTime()}] [ERROR] Something went wrong adding {joinedArguments}" + Fore.WHITE)
        if message.author.display_name not in data['FullAccess']:
            await message.reply(f"You don't have access to this command!")

    if "!remove" in args[0].lower() and message.author.display_name in data['FullAccess']:
        user = await client.fetch_profile(joinedArguments)
        friends = client.friends
        if user is None:
            await message.reply(f"I can't find a player with the name of {joinedArguments}.")
            print(Fore.RED + f" [RenegadeFN] [{getTime()}] [ERROR] Unable to find a player with the name {joinedArguments}")
        else:
            try:
                if (user.id in friends):
                    await client.remove_or_decline_friend(user.id)
                    await message.reply(f"Sucessfully removed {user.display_name} as a friend.")
                    print(Fore.GREEN + f" [RenegadeFN] [{getTime()}] {client.user.display_name} removed {user.display_name} as a friend.")
                else: 
                    await message.reply(f"I don't have {user.display_name} as a friend.")
                    print(Fore.RED + f" [RenegadeFN] [{getTime()}] [ERROR] {client.user.display_name} tried removing {user.display_name} as a friend, but the client doesn't have the friend added." + Fore.WHITE)
            except Exception as e:
                pass
                print(Fore.RED + f" [RenegadeFN] [{getTime()}] [ERROR] Something went wrong removing {joinedArguments} as a friend." + Fore.WHITE)
        if message.author.display_name not in data['FullAccess']:
            await message.reply(f"You don't have access to this command!")

    if "!showfriends" in args[0].lower() and message.author.display_name in data['FullAccess']:
        friends = client.friends
        onlineFriends = []
        offlineFriends = []
        try:
            for f in friends:
                friend = client.get_friend(f)
                if friend.is_online():
                    onlineFriends.append(friend.display_name)
                else:
                    offlineFriends.append(friend.display_name)
            print(f" [RenegadeFN] [{getTime()}] " + Fore.WHITE + "Friends List: " + Fore.GREEN + f"{len(onlineFriends)} Online " + Fore.WHITE + "/" + Fore.LIGHTBLACK_EX + f" {len(offlineFriends)} Offline " + Fore.WHITE + "/" + Fore.LIGHTWHITE_EX + f" {len(onlineFriends) + len(offlineFriends)} Total")
            for x in onlineFriends:
                if x is not None:
                    print(Fore.GREEN + " " + x + Fore.WHITE)
            for x in offlineFriends:
                if x is not None:
                    print(Fore.LIGHTBLACK_EX + " " + x + Fore.WHITE)
        except Exception as e:
            pass
        await message.reply("Check the command window for the list of my friends.")   
        if message.author.display_name not in data['FullAccess']:
            await message.reply(f"You don't have access to this command!")

    if "!members" in args[0].lower() and message.author.display_name in data['FullAccess']:
            members = client.user.party.members
            partyMembers = []
            for m in members:
                member = client.get_user(m)
                partyMembers.append(member.display_name)
            print(f" [RenegadeFN] [{getTime()}] " + Fore.WHITE + "There are " + Fore.LIGHTWHITE_EX + f"{len(partyMembers)} members in client's party:")
            await message.reply(f"There are {len(partyMembers)} members in {client.user.display_name}'s party:")
            for x in partyMembers:
                if x is not None:
                    print(Fore.GREEN + " " + x + Fore.WHITE)
                    await message.reply(x)

    if "!promote" in args[0].lower() and message.author.display_name in data['FullAccess']:
        if len(args) != 1:
            user = await client.fetch_profile(joinedArguments)
            member = client.user.party.members.get(user.id)
        if len(args) == 1:
            user = await client.fetch_profile(message.author.display_name)
            member = client.user.party.members.get(user.id)
        if member is None:
            await message.reply("Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.promote()
                await message.reply(f"Promoted user: {member.display_name}.")
                print(Fore.GREEN + f" [RenegadeFN] [{getTime()}] Promoted user: {member.display_name}")
            except Exception as e:
                pass
                await message.reply(f"Couldn't promote {member.display_name}, as I'm not party leader.")
                print(Fore.RED + f" [RenegadeFN] [{getTime()}] [ERROR] Failed to promote member as I don't have the required permissions." + Fore.WHITE)
        if message.author.display_name not in data['FullAccess']:
            await message.reply(f"You don't have access to this command!")

    if "Playlist_" in args[0]:
        try:
            await client.user.party.set_playlist(playlist=args[0])
        except Exception as e:
            pass
            await message.reply(f"Couldn't set gamemode to {args[0]}, as I'm not party leader.")
            print(Fore.RED + f" [RenegadeFN] [{getTime()}] [ERROR] Failed to set gamemode as I don't have the required permissions." + Fore.WHITE)

    if "!platform" in args[0] and message.author.display_name in data['FullAccess']:
        await message.reply('Setting platform to ' + args[1] + '.')
        party_id = client.user.party.id
        await client.user.party.me.leave()
        client.platform = fortnitepy.Platform(args[1])
        await message.reply('Platform set to ' + str(client.platform) + '.')
        try:
            await client.join_to_party(party_id, check_private=True)
        except Exception as e:
            pass
            await message.reply('Failed to join back as party is set to private.')
        else:
            if message.author.display_name not in data['FullAccess']:
                await message.reply(f"You don't have access to this command!")

    if args[0] == "!id":
        if message.author.display_name in data['BlockList']:
            await message.reply("You don't have access to this command!")
        else:
            user = await client.fetch_profile(joinedArguments, cache=False, raw=False)
            try:
                await message.reply(f"{joinedArguments}'s Epic ID is: {user.id}")
                print(Fore.GREEN + f" [RenegadeFN] [{getTime()}] {joinedArguments}'s Epic ID is: {user.id}")
            except AttributeError:
                await message.reply(f"I couldn't find an Epic account with the name: {joinedArguments}.")
                print(Fore.RED + f" [RenegadeFN] [{getTime()}] [ERROR] I couldn't find an Epic account with the name: {joinedArguments}.")
Exemplo n.º 6
0
    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
Exemplo n.º 7
0
async def event_friend_message(message):
    args = message.content.split()
    split = args[1:]
    content = " ".join(split)
    print(
        f'[FORTNITEPY] [{getTime()}] {message.author.display_name}: {message.content}'
    )

    if "!skin" in args[0].lower():
        id = await BenBotAsync.getSkinId(content)
        if id == None:
            await message.reply(
                f"Couldn't find a skin with the name: {content}")
        else:
            await client.user.party.me.set_outfit(asset=id)
            await message.reply('Skin set to ' + id)
            print(f"[FORTNITEPY] [{getTime()}] Set Skin to: " + id)

    if "!backpack" in args[0].lower():
        id = await BenBotAsync.getBackpackId(content)
        if id == None:
            await message.reply(
                f"Couldn't find a backpack with the name: {content}")
        else:
            await client.user.party.me.set_backpack(asset=id)
            await message.reply('Backpack set to ' + id)
            print(f"[FORTNITEPY] [{getTime()}] Set Backpack to: " + id)

    if "!emote" in args[0].lower():
        await client.user.party.me.clear_emote()
        id = await BenBotAsync.getEmoteId(content)
        if id == None:
            await message.reply(
                f"Couldn't find a skin with the name: {content}")
        else:
            await client.user.party.me.set_emote(asset=id)
            await message.reply('Skin set to ' + id)
            print(f"[FORTNITEPY] [{getTime()}] Set Skin to: " + id)

    if "!pickaxe" in args[0].lower():
        id = await BenBotAsync.getPickaxeId(content)
        if id == None:
            await message.reply(
                f"Couldn't find a pickaxe with the name: {content}")
        else:
            await client.user.party.me.set_pickaxe(asset=id)
            await message.reply('Pickaxe set to ' + id)
            print(f"[FORTNITEPY] [{getTime()}] Set Pickaxe to: " + id)

    if "!pet" in args[0].lower():
        id = await BenBotAsync.getPetId(content)
        await client.user.party.me.set_backpack(
            asset="/Game/Athena/Items/Cosmetics/PetCarriers/" + id + "." + id)

        await message.reply('Pet set to ' + id)
        print(f"[FORTNITEPY] [{getTime()}] Client's PetCarrier set to: " + id)

    if "!emoji" in args[0].lower():
        id = await fetch_cosmetic_id(' '.join(split), 'AthenaDance')
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
            asset="/Game/Athena/Items/Cosmetics/Dances/Emoji/" + id + "." + id)

        await message.reply('Emoji set to ' + id)
        print(f"[FORTNITEPY] [{getTime()}] Client's Emoji set to " + id)

    if "!purpleskull" in args[0].lower():
        variants = client.user.party.me.create_variants(clothing_color=1)

        await client.user.party.me.set_outfit(
            asset='CID_030_Athena_Commando_M_Halloween', variants=variants)

        await message.reply('Skin set to Purple Skull Trooper!')

    if "!pinkghoul" in args[0].lower():
        variants = client.user.party.me.create_variants(material=3)

        await client.user.party.me.set_outfit(
            asset='CID_029_Athena_Commando_F_Halloween', variants=variants)

        await message.reply('Skin set to Pink Ghoul Trooper!')

    if "!brainiacghoul" in args[0].lower():
        variants = client.user.party.me.create_variants(material=2)

        await client.user.party.me.set_outfit(
            asset='CID_029_Athena_Commando_F_Halloween', variants=variants)

        await message.reply('Skin set to Brainiac Ghoul Trooper!')

    if "!purpleportal" in args[0].lower():
        variants = client.user.party.me.create_variants(
            item='AthenaBackpack', particle_config='Particle', particle=1)

        await client.user.party.me.set_backpack(asset='BID_105_GhostPortal',
                                                variants=variants)

        await message.reply('Backpack set to Purple Ghost Portal!')

    if "!banner" in args[0].lower():
        if len(args) == 1:
            await message.reply(
                'You need to specify which banner, color & level you want to set the banner as.'
            )
        if len(args) == 2:
            await client.user.party.me.set_banner(icon=args[1],
                                                  color=data['banner_colour'],
                                                  season_level=data['level'])
        if len(args) == 3:
            await client.user.party.me.set_banner(icon=args[1],
                                                  color=args[2],
                                                  season_level=data['level'])
        if len(args) == 4:
            await client.user.party.me.set_banner(icon=args[1],
                                                  color=args[2],
                                                  season_level=args[3])

        await message.reply(f'Banner set to; {args[1]} {args[2]} {args[3]}')
        print(
            f"[FORTNITEPY] [{getTime()}] Banner set to; {args[1]} {args[2]} {args[3]}"
        )

    if "CID_" in args[0]:
        await client.user.party.me.set_outfit(asset=args[0])

        await message.reply(f'Skin set to {args[0]}')
        await print(f'[FORTNITEPY] [{getTime()}] Skin set to ' + args[0])

    if "VTID_" in args[0]:
        VTID = await setVTID(args[0])
        if VTID[1] == 'Particle':
            variants = client.user.party.me.create_variants(
                particle_config='Particle', particle=1)
        else:
            variants = client.user.party.me.create_variants(
                **{VTID[1].lower(): int(VTID[2])})

        await client.user.party.me.set_outfit(asset=VTID[0], variants=variants)
        await message.reply(
            f'Variants set to {args[0]}.\n(Warning: This feature is not supported, please use !variants)'
        )

    if "!variants" in args[0]:
        args3 = int(args[3])

        if 'CID' in args[1]:
            variants = client.user.party.me.create_variants(**{args[2]: args3})
            await client.user.party.me.set_outfit(asset=args[1],
                                                  variants=variants)
        elif 'BID' in args[1]:
            variants = client.user.party.me.create_variants(
                item='AthenaBackpack', **{args[2]: args3})
            await client.user.party.me.set_backpack(asset=args[1],
                                                    variants=variants)
        elif 'PICKAXE_ID' in args[1]:
            variants = client.user.party.me.create_variants(
                item='AthenaPickaxe', **{args[2]: args3})
            await client.user.party.me.set_pickaxe(asset=args[1],
                                                   variants=variants)

        await message.reply(
            f'Set variants of {args[1]} to {args[2]} {args[3]}.')
        print(
            f'[FORTNITEPY] [{getTime()}] Set variants of {args[1]} to {args[2]} {args[3]}.'
        )

    if "!checkeredrenegade" in args[0].lower():
        variants = client.user.party.me.create_variants(material=2)

        await client.user.party.me.set_outfit(
            asset='CID_028_Athena_Commando_F', variants=variants)

        await message.reply('Skin set to Checkered Renegade!')

    if "EID_" in args[0]:
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(asset=args[0])
        await message.reply('Emote set to ' + args[0] + '!')

    if "!stop" in args[0].lower():
        await client.user.party.me.clear_emote()
        await message.reply('Stopped emoting.')

    if "BID_" in args[0]:
        await client.user.party.me.set_backpack(asset=args[0])

        await message.reply('Backbling set to ' + message.content + '!')

    if "!help" in args[0].lower():
        await message.reply(
            'For a list of commands, goto; https://github.com/xMistt/fortnitepy-bot'
        )

    if "PICKAXE_ID_" in args[0].lower():
        await client.user.party.me.set_pickaxe(asset=args[0])

        await message.reply('Pickaxe set to ' + args[0] + '!')

    if "PetCarrier_" in args[0]:
        await client.user.party.me.set_backpack(
            asset="/Game/Athena/Items/Cosmetics/PetCarriers/" + args[0] + "." +
            args[0])

    if "Emoji_" in args[0]:
        await client.user.party.me.set_emote(asset='EID_ClearEmote')
        await client.user.party.me.set_emote(
            asset="/Game/Athena/Items/Cosmetics/Dances/Emoji/" + args[0] +
            "." + args[0])

    if "!legacypickaxe" in args[0].lower():
        await client.user.party.me.set_pickaxe(asset=args[1])

        await message.reply('Pickaxe set to ' + args[1] + '!')

    if "!ready" in args[0].lower():
        await client.user.party.me.set_ready(True)
        await message.reply('Ready!')

    if ("!unready" in args[0].lower()) or ("!sitin" in args[0].lower()):
        await client.user.party.me.set_ready(False)
        await message.reply('Unready!')

    if "!sitout" in args[0].lower():
        await client.user.party.me.set_ready(None)
        await message.reply('Sitting Out!')

    if "!bp" in args[0].lower():
        await client.user.party.me.set_battlepass_info(has_purchased=True,
                                                       level=args[1],
                                                       self_boost_xp='0',
                                                       friend_boost_xp='0')

    if "!level" in args[0].lower():
        await client.user.party.me.set_banner(
            icon=client.user.party.me.banner[0],
            color=client.user.party.me.banner[1],
            season_level=args[1])

    if "!echo" in args[0].lower():
        await client.user.party.send(content)

    if "!status" in args[0].lower():
        await client.set_status(content)

        await message.reply(f'Status set to {content}')
        print(f'[FORTNITEPY] [{getTime()}] Status set to {content}.')

    if "!leave" in args[0].lower():
        await client.user.party.me.set_emote('EID_Wave')
        delay.sleep(2)
        await client.user.party.me.leave()
        await message.reply('Bye!')
        print(f'[FORTNITEPY] [{getTime()}] Left the party as I was requested.')

    if "!kick" in args[0].lower():
        user = await client.fetch_profile(content)
        member = client.user.party.members.get(user.id)
        if member is None:
            await message.reply(
                "Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.kick()
                await message.reply(f"Kicked user: {member.display_name}.")
                print(
                    f"[FORTNITEPY] [{getTime()}] Kicked user: {member.display_name}"
                )
            except fortnitepy.PartyPermissionError:
                await message.reply(
                    f"Couldn't kick {member.display_name}, as I'm not party leader."
                )
                print(
                    Fore.RED +
                    f"[FORTNITEPY] [{getTime()}] [ERROR] Failed to kick member as I don't have the required permissions."
                    + Fore.WHITE)

    if "!promote" in args[0].lower():
        if len(args) != 1:
            user = await client.fetch_profile(content)
            member = client.user.party.members.get(user.id)
        if len(args) == 1:
            user = await client.fetch_profile(message.author.display_name)
            user = await client.user.party.members.get(user.id)

        if member is None:
            await message.reply(
                "Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.promote()
                await message.reply(f"Promoted user: {member.display_name}.")
                print(
                    f"[FORTNITEPY] [{getTime()}] Promoted user: {member.display_name}"
                )
            except fortnitepy.PartyPermissionError:
                await message.reply(
                    f"Couldn't promote {member.display_name}, as I'm not party leader."
                )
                print(
                    Fore.RED +
                    f"[FORTNITEPY] [{getTime()}] [ERROR] Failed to promote member as I don't have the required permissions."
                    + Fore.WHITE)

    if "Playlist_" in args[0]:
        try:
            await client.user.party.set_playlist(playlist=args[0])
        except fortnitepy.PartyPermissionError:
            await message.reply(
                f"Couldn't set gamemode to {args[1]}, as I'm not party leader."
            )
            print(
                Fore.RED +
                f"[FORTNITEPY] [{getTime()}] [ERROR] Failed to set gamemode as I don't have the required permissions."
                + Fore.WHITE)

    if "!platform" in args[0]:
        await message.reply('Setting platform to ' + args[1] + '.')
        party_id = client.user.party.id
        await client.user.party.me.leave()
        client.platform = fortnitepy.Platform(args[1])
        await message.reply('Platform set to ' + str(client.platform) + '.')
        try:
            await client.join_to_party(party_id, check_private=True)
        except fortnitepy.Forbidden:
            await message.reply(
                'Failed to join back as party is set to private.')

    if args[0] == "!id":
        user = await client.fetch_profile(content, cache=False, raw=False)
        try:
            await message.reply(f"{content}'s Epic ID is: {user.id}")
        except AttributeError:
            await message.reply(
                f"I couldn't find an Epic account with the name: {content}.")
Exemplo n.º 8
0
async def event_friend_message(message):
    args = message.content.split()
    split = args[1:]
    content = " ".join(split)

    print(f'[PartyBot] [{time()}] {message.author.display_name}: {message.content}')

    if "!skin" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.TYPE, 'Outfit']
        )

        if cosmetic == None:
            print('Hi, it equals none!')
            await message.reply(f"Couldn't find a skin with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find a skin with the name: {content}.")
        else:
            await message.reply(f'Skin set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set skin to: {cosmetic.id}.")
            await client.user.party.me.set_outfit(asset=cosmetic.id)
        
    elif "!backpack" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.TYPE, 'Back Bling']
        )

        if cosmetic == None:
            await message.reply(f"Couldn't find a backpack with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find a backpack with the name: {content}.")
        else:
            await message.reply(f'Backpack set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set backpack to: {cosmetic.id}.")
            await client.user.party.me.set_backpack(asset=cosmetic.id)

    elif "!emote" in args[0].lower():
        await client.user.party.me.clear_emote()

        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.TYPE, 'Emote']
        )

        if cosmetic == None:
            await message.reply(f"Couldn't find a emote with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find a emote with the name: {content}.")
        else:
            await message.reply(f'Emote set to {cosmetic.displayName}.')
            print(f"[PartyBot] [{time()}] Set emote to: {cosmetic.displayName}.")
            await client.user.party.me.set_emote(asset=cosmetic.id)

    elif "!pickaxe" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.TYPE, 'Harvesting Tool']
        )

        if cosmetic == None:
            await message.reply(f"Couldn't find a pickaxe with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find a pickaxe with the name: {content}.")
        else:
            await message.reply(f'Pickaxe set to {cosmetic.displayName}.')
            print(f"[PartyBot] [{time()}] Set pickaxe to: {cosmetic.displayName}.")
            await client.user.party.me.set_pickaxe(asset=cosmetic.id)

    elif "!pet" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.BACKEND_TYPE, 'AthenaPet']
        )

        if cosmetic == None:
            await message.reply(f"Couldn't find a pet with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find a pet with the name: {content}.")
        else:
            await message.reply(f'Pet set to {cosmetic.displayName}.')
            print(f"[PartyBot] [{time()}] Set pet to: {cosmetic.displayName}.")
            await client.user.party.me.set_pet(asset=cosmetic.id)

    elif "!emoji" in args[0].lower():
        await client.user.party.me.clear_emote()

        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.BACKEND_TYPE, 'AthenaDance']
        )

        if cosmetic == None:
            await message.reply(f"Couldn't find an emoji with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find an emoji with the name: {content}.")
        else:
            await message.reply(f'Emoji set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set emoji to: {cosmetic.id}.")
            await client.user.party.me.set_emoji(asset=cosmetic.id)

    elif "!contrail" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.TYPE, 'Contrail']
        )

        if cosmetic == None:
            await message.reply(f"Couldn't find a contrail with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find an contrail with the name: {content}.")
        else:
            await message.reply(f'Contrail set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set contrail to: {cosmetic.id}.")
            await client.user.party.me.set_contrail(cosmetic.id)

    elif "!purpleskull" in args[0].lower():
        variants = client.user.party.me.create_variants(
           clothing_color=1
        )

        await client.user.party.me.set_outfit(
            asset='CID_030_Athena_Commando_M_Halloween',
            variants=variants
        )

        await message.reply('Skin set to Purple Skull Trooper!')

    elif "!pinkghoul" in args[0].lower():
        variants = client.user.party.me.create_variants(
           material=3
        )

        await client.user.party.me.set_outfit(
            asset='CID_029_Athena_Commando_F_Halloween',
            variants=variants
        )

        await message.reply('Skin set to Pink Ghoul Trooper!')

    elif "!purpleportal" in args[0].lower():
        variants = client.user.party.me.create_variants(
            item='AthenaBackpack',
            particle_config='Particle',
            particle=1
        )

        await client.user.party.me.set_backpack(
            asset='BID_105_GhostPortal',
            variants=variants
        )

        await message.reply('Backpack set to Purple Ghost Portal!')

    elif "!banner" in args[0].lower():
        if len(args) == 1:
            await message.reply('You need to specifiy which banner, color & level you want to set the banner as.')
        elif len(args) == 2:
            await client.user.party.me.set_banner(icon=args[1], color=data['banner_colour'], season_level=data['level'])
        elif len(args) == 3:
            await client.user.party.me.set_banner(icon=args[1], color=args[2], season_level=data['level'])
        elif len(args) == 4:
            await client.user.party.me.set_banner(icon=args[1], color=args[2], season_level=args[3])
        else:
            await message.reply('You entered too many arguments!')

        await message.reply(f'Banner set to; {args[1]} {args[2]} {args[3]}')
        print(f"[PartyBot] [{time()}] Banner set to; {args[1]} {args[2]} {args[3]}")

    elif "cid_" in args[0].lower():
        if 'banner' not in args[0]:
            await client.user.party.me.set_outfit(
                asset=args[0]
            )
        else:
            await client.user.party.me.set_outfit(
                asset=args[0],
                variants=client.user.party.me.create_variants(profilebanner='ProfileBanner')
            )

        await message.reply(f'Skin set to {args[0]}')
        await print(f'[PartyBot] [{time()}] Skin set to {args[0]}')

    elif "vtid_" in args[0].lower():
        VTID = await setVTID(args[0])
        if VTID[1] == 'Particle':
            variants = client.user.party.me.create_variants(particle_config='Particle', particle=1)
        else:
            variants = client.user.party.me.create_variants(**{VTID[1].lower(): int(VTID[2])})

        await client.user.party.me.set_outfit(asset=VTID[0], variants=variants)
        await message.reply(f'Variants set to {args[0]}.\n(Warning: This feature is not supported, please use !variants)')

    elif "!variants" in args[0]:
        try:
            args3 = int(args[3])
        except ValueError:
            args3 = args[3]

        if 'cid' in args[1].lower() and 'jersey_color' not in args[2]:
            variants = client.user.party.me.create_variants(**{args[2]: args[3]})
            await client.user.party.me.set_outfit(
                asset=args[1],
                variants=variants
            )
        elif 'cid' in args[1].lower() and 'jersey_color' in args[2]:
            variants = client.user.party.me.create_variants(pattern=0, numeric=69, **{args[2]: args[3]})
            await client.user.party.me.set_outfit(
                asset=args[1],
                variants=variants
            )
        elif 'bid' in args[1].lower():
            variants = client.user.party.me.create_variants(item='AthenaBackpack', **{args[2]: args3})
            await client.user.party.me.set_backpack(
                asset=args[1],
                variants=variants
            )
        elif 'pickaxe_id' in args[1].lower():
            variants = client.user.party.me.create_variants(item='AthenaPickaxe', **{args[2]: args3})
            await client.user.party.me.set_pickaxe(
                asset=args[1],
                variants=variants
            )

        await message.reply(f'Set variants of {args[1]} to {args[2]} {args[3]}.')
        print(f'[PartyBot] [{time()}] Set variants of {args[1]} to {args[2]} {args[3]}.')

    elif "!checkeredrenegade" in args[0].lower():
        variants = client.user.party.me.create_variants(
           material=2
        )

        await client.user.party.me.set_outfit(
            asset='CID_028_Athena_Commando_F',
            variants=variants
        )

        await message.reply('Skin set to Checkered Renegade!')

    elif "!mintyelf" in args[0].lower():
        variants = client.user.party.me.create_variants(
           material=2
        )

        await client.user.party.me.set_outfit(
            asset='CID_051_Athena_Commando_M_HolidayElf',
            variants=variants
        )

        await message.reply('Skin set to Minty Elf!')

    elif "eid_" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
            asset=args[0]
        )
        await message.reply(f'Emote set to {args[0]}!')
        
    elif "!stop" in args[0].lower():
        await client.user.party.me.clear_emote()
        await message.reply('Stopped emoting.')

    elif "bid_" in args[0].lower():
        await client.user.party.me.set_backpack(
            asset=args[0]
        )

        await message.reply(f'Backbling set to {args[0]}!')

    elif "!help" in args[0].lower():
        await message.reply('For a list of commands, goto; https://github.com/xMistt/fortnitepy-bot/wiki/Commands')

    elif "PICKAXE_ID_" in args[0].lower():
        await client.user.party.me.set_pickaxe(
                asset=args[0]
        )

        await message.reply(f'Pickaxe set to {args[0]}')

    elif "petcarrier_" in args[0].lower():
        await client.user.party.me.set_pet(
                asset=args[0]
        )

        await message.reply(f'Pet set to {args[0]}!')

    elif "emoji_" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
                asset=args[0]
        )

        await message.reply(f'Emoji set to {args[0]}!')

    elif "trails_" in args[0].lower():
        await client.user.party.me.set_contrail(asset=args[0])

        await message.reply(f'Contrail set to {args[0]}!')

    elif "!legacypickaxe" in args[0].lower():
        await client.user.party.me.set_pickaxe(
                asset=args[1]
        )

        await message.reply(f'Pickaxe set to {args[1]}!')

    elif "!point" in args[0].lower():
        if 'pickaxe_id' in args[1].lower():
            await client.user.party.me.set_pickaxe(asset=args[1])
            await client.user.party.me.set_emote(asset='EID_IceKing')
            await message.reply(f'Pickaxe set to {args[1]} & Point it Out played.')
        else:
            cosmetic = await BenBotAsync.get_cosmetic(content, params=BenBotAsync.Tags.NAME, filter=[BenBotAsync.Filters.TYPE, 'Harvesting Tool'])
            if cosmetic == None:
                await message.reply(f"Couldn't find a pickaxe with the name: {content}")
            else:
                await client.user.party.me.set_pickaxe(asset=cosmetic.id)
                await client.user.party.me.set_emote(asset='EID_IceKing')
                await message.reply(f'Pickaxe set to {content} & Point it Out played.')


    elif "!ready" in args[0].lower():
        await client.user.party.me.set_ready(fortnitepy.ReadyState.READY)
        await message.reply('Ready!')

    elif ("!unready" in args[0].lower()) or ("!sitin" in args[0].lower()):
        await client.user.party.me.set_ready(fortnitepy.ReadyState.NOT_READY)
        await message.reply('Unready!')

    elif "!sitout" in args[0].lower():
        await client.user.party.me.set_ready(fortnitepy.ReadyState.SITTING_OUT)
        await message.reply('Sitting Out!')

    elif "!bp" in args[0].lower():
        await client.user.party.me.set_battlepass_info(has_purchased=True, level=args[1], self_boost_xp='0', friend_boost_xp='0')

    elif "!level" in args[0].lower():
        await client.user.party.me.set_banner(icon=client.user.party.me.banner[0], color=client.user.party.me.banner[1], season_level=args[1])

    elif "!echo" in args[0].lower():
        await client.user.party.send(content)

    elif "!status" in args[0].lower():
        await client.set_status(content)

        await message.reply(f'Status set to {content}')
        print(f'[PartyBot] [{time()}] Status set to {content}.')

    elif "!leave" in args[0].lower():
        await client.user.party.me.set_emote('EID_Wave')
        await asyncio.sleep(2)
        await client.user.party.me.leave()
        await message.reply('Bye!')
        print(f'[PartyBot] [{time()}] Left the party as I was requested.')

    elif "!kick" in args[0].lower():
        user = await client.fetch_profile(content)
        member = client.user.party.members.get(user.id)
        if member is None:
            await message.reply("Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.kick()
                await message.reply(f"Kicked user: {member.display_name}.")
                print(f"[PartyBot] [{time()}] Kicked user: {member.display_name}")
            except fortnitepy.Forbidden:
                await message.reply(f"Couldn't kick {member.display_name}, as I'm not party leader.")
                print(crayons.red(f"[PartyBot] [{time()}] [ERROR] Failed to kick member as I don't have the required permissions."))

    elif "!promote" in args[0].lower():
        if len(args) != 1:
            user = await client.fetch_profile(content)
            member = client.user.party.members.get(user.id)
        if len(args) == 1:
            user = await client.fetch_profile(message.author.display_name)
            user = await client.user.party.members.get(user.id)

        if member is None:
            await message.reply("Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.promote()
                await message.reply(f"Promoted user: {member.display_name}.")
                print(f"[PartyBot] [{time()}] Promoted user: {member.display_name}")
            except fortnitepy.Forbidden:
                await message.reply(f"Couldn't promote {member.display_name}, as I'm not party leader.")
                print(crayons.red(f"[PartyBot] [{time()}] [ERROR] Failed to promote member as I don't have the required permissions."))

    elif "playlist_" in args[0].lower():
        try:
            await client.user.party.set_playlist(playlist=args[0])
        except fortnitepy.Forbidden:
            await message.reply(f"Couldn't set gamemode to {args[1]}, as I'm not party leader.")
            print(crayons.red(f"[PartyBot] [{time()}] [ERROR] Failed to set gamemode as I don't have the required permissions."))

    elif "!platform" in args[0].lower():
        await message.reply(f'Setting platform to {args[0]}')
        party_id = client.user.party.id
        await client.user.party.me.leave()
        client.platform = fortnitepy.Platform(args[1])
        await message.reply(f'Platform set to {str(client.platform)}.')
        try:
            await client.join_to_party(party_id, check_private=True)
        except fortnitepy.Forbidden:
            await message.reply('Failed to join back as party is set to private.')

    elif args[0].lower() == "!id":
        user = await client.fetch_profile(content, cache=False, raw=False)
        try:
            await message.reply(f"{content}'s Epic ID is: {user.id}")
        except AttributeError:
            await message.reply(f"I couldn't find an Epic account with the name: {content}.")

    elif "!privacy" in args[0].lower():
        try:
            if 'public' in args[1].lower():
                await client.user.party.set_privacy(fortnitepy.PartyPrivacy.PUBLIC)
            elif 'private' in args[1].lower():
                await client.user.party.set_privacy(fortnitepy.PartyPrivacy.PRIVATE)
            elif 'friends' in args[1].lower():
                await client.user.party.set_privacy(fortnitepy.PartyPrivacy.FRIENDS)
            elif 'friends_allow_friends_of_friends' in args[1].lower():
                await client.user.party.set_privacy(fortnitepy.PartyPrivacy.FRIENDS_ALLOW_FRIENDS_OF_FRIENDS)
            elif 'private_allow_friends_of_friends' in args[1].lower():
                await client.user.party.set_privacy(fortnitepy.PartyPrivacy.PRIVATE_ALLOW_FRIENDS_OF_FRIENDS)

            await message.reply(f'Party privacy set to {client.user.party.privacy}.')
            print(f'[PartyBot] [{time()}] Party privacy set to {client.user.party.privacy}.')

        except fortnitepy.Forbidden:
            await message.reply(f"Couldn't set party privacy to {args[1]}, as I'm not party leader.")
            print(crayons.red(f"[PartyBot] [{time()}] [ERROR] Failed to set party privacy as I don't have the required permissions."))

    elif "!copy" in args[0].lower():
        if len(args) >= 1:
            member = client.user.party.members.get(message.author.id)
        else:
            user = await client.fetch_profile(content)
            member = client.user.party.members.get(user.id)

        await client.user.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], self_boost_xp='0', friend_boost_xp='0')
        )

        await client.user.party.me.set_emote(asset=member.emote)

    elif "!hologram" in args[0].lower():
        await client.user.party.me.set_outfit(
            asset='CID_VIP_Athena_Commando_M_GalileoGondola_SG'
        )

        await message.reply('Skin set to Star Wars Hologram!')

    elif "!gift" in args[0].lower():
        await client.user.party.me.clear_emote()

        await client.user.party.me.set_emote(
            asset='EID_NeverGonna'
        )

        await message.reply('What did you think would happen?')

    elif "!matchmakingcode" in args[0].lower():
        await client.user.party.set_custom_key(
            key=content
        )

        await message.reply(f'Custom matchmaking code set to: {content}')

    elif "!ninja" in args[0].lower():
        await client.user.party.me.set_outfit(
            asset='CID_605_Athena_Commando_M_TourBus'
        )

        await message.reply('Skin set to Ninja!')

    elif "!ponpon" in args[0].lower():
        await client.user.party.me.set_emote(
            asset='EID_TourBus'
        )

        await message.reply('Emote set to Ninja Style!')
Exemplo n.º 9
0
async def event_friend_message(message):
    args = message.content.split()
    split = args[1:]
    content = " ".join(split)

    print(f'[PartyBot] [{time()}] {message.author.display_name}: {message.content}')

    if "!skin" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.TYPE, 'Outfit']
        )

        if cosmetic == None:
            print('Hi, it equals none!')
            await message.reply(f"Couldn't find a skin with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find a skin with the name: {content}.")
        else:
            await message.reply(f'Skin set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set skin to: {cosmetic.id}.")
            await client.user.party.me.set_outfit(asset=cosmetic.id)
        
    elif "!backpack" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.TYPE, 'Back Bling']
        )

        if cosmetic == None:
            await message.reply(f"Couldn't find a backpack with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find a backpack with the name: {content}.")
        else:
            await message.reply(f'Backpack set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set backpack to: {cosmetic.id}.")
            await client.user.party.me.set_backpack(asset=cosmetic.id)

    elif "!emote" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.TYPE, 'Emote']
        )

        if cosmetic == None:
            await message.reply(f"Couldn't find a emote with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find a emote with the name: {content}.")
        else:
            await message.reply(f'Emote set to {cosmetic.displayName}.')
            print(f"[PartyBot] [{time()}] Set emote to: {cosmetic.displayName}.")
            await client.user.party.me.set_emote(asset=cosmetic.id)

    elif "!pickaxe" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.TYPE, 'Harvesting Tool']
        )

        if cosmetic == None:
            await message.reply(f"Couldn't find a pickaxe with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find a pickaxe with the name: {content}.")
        else:
            await message.reply(f'Pickaxe set to {cosmetic.displayName}.')
            print(f"[PartyBot] [{time()}] Set pickaxe to: {cosmetic.displayName}.")
            await client.user.party.me.set_pickaxe(asset=cosmetic.id)

    elif "!pet" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.BACKEND_TYPE, 'AthenaPet']
        )

        if cosmetic == None:
            await message.reply(f"Couldn't find a pet with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find a pet with the name: {content}.")
        else:
            await message.reply(f'Pet set to {cosmetic.displayName}.')
            print(f"[PartyBot] [{time()}] Set pet to: {cosmetic.displayName}.")
            await client.user.party.me.set_pet(asset=cosmetic.id)

    elif "!emoji" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.BACKEND_TYPE, 'AthenaDance']
        )

        if cosmetic == None:
            await message.reply(f"Couldn't find an emoji with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find an emoji with the name: {content}.")
        else:
            await message.reply(f'Emoji set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set emoji to: {cosmetic.id}.")
            await client.user.party.me.set_emoji(asset=cosmetic.id)

    elif "!contrail" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(
            content,
            params=BenBotAsync.Tags.NAME,
            filter=[BenBotAsync.Filters.TYPE, 'Contrail']
        )

        if cosmetic == None:
            await message.reply(f"Couldn't find a contrail with the name: {content}.")
            print(f"[PartyBot] [{time()}] Couldn't find an contrail with the name: {content}.")
        else:
            await message.reply(f'Contrail set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set contrail to: {cosmetic.id}.")
            await client.user.party.me.set_contrail(cosmetic.id)

    elif "!purpleskull" in args[0].lower():
        variants = client.user.party.me.create_variants(
           clothing_color=1
        )

        await client.user.party.me.set_outfit(
            asset='CID_030_Athena_Commando_M_Halloween',
            variants=variants
        )

        await message.reply('Skin set to Purple Skull Trooper!')

    elif "!pinkghoul" in args[0].lower():
        variants = client.user.party.me.create_variants(
           material=3
        )

        await client.user.party.me.set_outfit(
            asset='CID_029_Athena_Commando_F_Halloween',
            variants=variants
        )

        await message.reply('Skin set to Pink Ghoul Trooper!')

    elif "!purpleportal" in args[0].lower():
        variants = client.user.party.me.create_variants(
            item='AthenaBackpack',
            particle_config='Particle',
            particle=1
        )

        await client.user.party.me.set_backpack(
            asset='BID_105_GhostPortal',
            variants=variants
        )

        await message.reply('Backpack set to Purple Ghost Portal!')

    elif "!banner" in args[0].lower():
        if len(args) == 1:
            await message.reply('You need to specifiy which banner, color & level you want to set the banner as.')
        elif len(args) == 2:
            await client.user.party.me.set_banner(icon=args[1], color=data['banner_colour'], season_level=data['level'])
        elif len(args) == 3:
            await client.user.party.me.set_banner(icon=args[1], color=args[2], season_level=data['level'])
        elif len(args) == 4:
            await client.user.party.me.set_banner(icon=args[1], color=args[2], season_level=args[3])
        else:
            await message.reply('You entered too many arguments!')

        await message.reply(f'Banner set to; {args[1]} {args[2]} {args[3]}')
        print(f"[PartyBot] [{time()}] Banner set to; {args[1]} {args[2]} {args[3]}")

    elif "cid_" in args[0].lower():
        if 'banner' not in args[0]:
            await client.user.party.me.set_outfit(
                asset=args[0]
            )
        else:
            await client.user.party.me.set_outfit(
                asset=args[0],
                variants=client.user.party.me.create_variants(profilebanner='ProfileBanner')
            )

        await message.reply(f'Skin set to {args[0]}')
        await print(f'[PartyBot] [{time()}] Skin set to {args[0]}')

    elif "vtid_" in args[0].lower():
        VTID = await setVTID(args[0])
        if VTID[1] == 'Particle':
            variants = client.user.party.me.create_variants(particle_config='Particle', particle=1)
        else:
            variants = client.user.party.me.create_variants(**{VTID[1].lower(): int(VTID[2])})

        await client.user.party.me.set_outfit(asset=VTID[0], variants=variants)
        await message.reply(f'Variants set to {args[0]}.\n(Warning: This feature is not supported, please use !variants)')

    elif "!variants" in args[0]:
        try:
            args3 = int(args[3])
        except ValueError:
            args3 = args[3]

        if 'cid' in args[1].lower() and 'jersey_color' not in args[2]:
            variants = client.user.party.me.create_variants(**{args[2]: args[3]})
            await client.user.party.me.set_outfit(
                asset=args[1],
                variants=variants
            )
        elif 'cid' in args[1].lower() and 'jersey_color' in args[2]:
            variants = client.user.party.me.create_variants(pattern=0, numeric=69, **{args[2]: args[3]})
            await client.user.party.me.set_outfit(
                asset=args[1],
                variants=variants
            )
        elif 'bid' in args[1].lower():
            variants = client.user.party.me.create_variants(item='AthenaBackpack', **{args[2]: args3})
            await client.user.party.me.set_backpack(
                asset=args[1],
                variants=variants
            )
        elif 'pickaxe_id' in args[1].lower():
            variants = client.user.party.me.create_variants(item='AthenaPickaxe', **{args[2]: args3})
            await client.user.party.me.set_pickaxe(
                asset=args[1],
                variants=variants
            )

        await message.reply(f'Set variants of {args[1]} to {args[2]} {args[3]}.')
        print(f'[PartyBot] [{time()}] Set variants of {args[1]} to {args[2]} {args[3]}.')

    elif "!checkeredrenegade" in args[0].lower():
        variants = client.user.party.me.create_variants(
           material=2
        )

        await client.user.party.me.set_outfit(
            asset='CID_028_Athena_Commando_F',
            variants=variants
        )

        await message.reply('Skin set to Checkered Renegade!')

    elif "!mintyelf" in args[0].lower():
        variants = client.user.party.me.create_variants(
           material=2
        )

        await client.user.party.me.set_outfit(
            asset='CID_051_Athena_Commando_M_HolidayElf',
            variants=variants
        )

        await message.reply('Skin set to Minty Elf!')

    elif "eid_" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
            asset=args[0]
        )
        await message.reply(f'Emote set to {args[0]}!')
        
    elif "!stop" in args[0].lower():
        await client.user.party.me.clear_emote()
        await message.reply('Stopped emoting.')

    elif "bid_" in args[0].lower():
        await client.user.party.me.set_backpack(
            asset=args[0]
        )

        await message.reply(f'Backbling set to {args[0]}!')

    elif "!help" in args[0].lower():
        await message.reply('!skin - Sets the outfit of the client using the outfits name.
Usage: !skin <skin name>

!backpack - Sets the backpack of the client using the backpacks name.
Usage: !backpack <backpack name>

!emote - Sets the emote of the client using the emotes name.
Usage: !emote <emote name>

!pickaxe - Sets the pickaxe of the client using the pickaxe name.
Usage: !pickaxe <pickaxe name>

!pet - Sets the pet (backpack) of the client using the pets name.
Usage: !pet <pet name>

!emote - Sets the emoji of the client using the emojis name.
Usage: !emoji <emoji name>

!variants - Creates the variants list by the variants you set.
Usage: !variants <CID> <style type> <integer>

!contrail - Sets the contrail of the client using the contrail name.
Usage: !contrail <contrail name>

!purpleskull - Sets the outfit of the client to Purple Skull Trooper.
Usage: !purpleskull

!pinkghoul - Sets the outfit of the client to Pink Ghoul Trooper.
Usage: !pinkghoul

!purpleportal - Sets the backpack of the client to Purple Ghost Portal.
Usage: !purpleportal

!checkeredrenegade - Sets the outfit of the client to Checkered Renegade. Usage: !checkeredrenegade

!banner - Sets the banner of the client.
Usage: !banner <icon> <colour> <level>

CID_ - Sets the outfit of the client using CID.
Usage: <CID>

BID_ Sets the backpack of the client using BID.
Usage: <BID>

PICKAXE_ID_ - Sets the pickaxe of the client using PICKAXE_ID.
Usage: <PICKAXE_ID>

EID_ - Sets the emote of the client using EID.
Usage: <EID>

PetCarrier_ - Sets the pet of the client using PetCarrier_.
Usage: <PetCarrier_>

Emoji_ - Sets the emoji of the client using Emoji_. Usage: <Emoji_>

Trails_ - Sets the contrail of the client using Trails_. Usage: <Trails_>

!stop - Clears/stops the emote currently playing.
Usage: !stop

!help - Displays a link to this webpage.
Usage: !help

!legacypickaxe - Sets the pickaxe of the client using Pickaxe_
Usage: !legacypickaxe <pickaxe>

!point - Sets pickaxe using PICKAXE_ID or display name & does 'Point it Out'
Usage: !point <PICKAXE_ID>

!copy - Copies the cosmetic loadout of the defined user. If user is left blank, the message author will be used. Usage: !copy <name [optional]>

Party Commands
!ready - Sets the readiness of the client to ready.
Usage: !ready

!unready/!sitin - Sets the readiness of the client to unready.
Usage: !unready

!sitout - Sets the readiness of the client to SittingOut.
Usage: !unready

!bp - Sets the battlepass info of the client.
Usage: !bp <level> <xp boost> <friend xp boost>

!echo - Sends message to party chat with the given content.
Usage: !echo <message>

!status - Sends and sets the status.
Usage: !status <text>

!leave - Leaves the current party.
Usage: !leave

!kick - Kicks the inputted user.
Usage: !kick <username>

Playlist_ - Sets the lobbies selected playlist.
Usage: <Playlist ID>

!platform - Sets the clients platform.
Usage: !platform <platform>')

    elif "PICKAXE_ID_" in args[0].lower():
        await client.user.party.me.set_pickaxe(
                asset=args[0]
        )

        await message.reply(f'Pickaxe set to {args[0]}')

    elif "petcarrier_" in args[0].lower():
        await client.user.party.me.set_pet(
                asset=args[0]
        )

        await message.reply(f'Pet set to {args[0]}!')

    elif "emoji_" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
                asset=args[0]
        )

        await message.reply(f'Emoji set to {args[0]}!')

    elif "trails_" in args[0].lower():
        await client.user.party.me.set_contrail(asset=args[0])

        await message.reply(f'Contrail set to {args[0]}!')

    elif "!legacypickaxe" in args[0].lower():
        await client.user.party.me.set_pickaxe(
                asset=args[1]
        )

        await message.reply(f'Pickaxe set to {args[1]}!')

    elif "!point" in args[0].lower():
        if 'pickaxe_id' in args[1].lower():
            await client.user.party.me.set_pickaxe(asset=args[1])
            await client.user.party.me.set_emote(asset='EID_IceKing')
            await message.reply(f'Pickaxe set to {args[1]} & Point it Out played.')
        else:
            cosmetic = await BenBotAsync.get_cosmetic(content, params=BenBotAsync.Tags.NAME, filter=[BenBotAsync.Filters.TYPE, 'Harvesting Tool'])
            if cosmetic == None:
                await message.reply(f"Couldn't find a pickaxe with the name: {content}")
            else:
                await client.user.party.me.set_pickaxe(asset=cosmetic.id)
                await client.user.party.me.set_emote(asset='EID_IceKing')
                await message.reply(f'Pickaxe set to {content} & Point it Out played.')


    elif "!ready" in args[0].lower():
        await client.user.party.me.set_ready(True)
        await message.reply('Ready!')

    elif ("!unready" in args[0].lower()) or ("!sitin" in args[0].lower()):
        await client.user.party.me.set_ready(False)
        await message.reply('Unready!')

    elif "!sitout" in args[0].lower():
        await client.user.party.me.set_ready(None)
        await message.reply('Sitting Out!')

    elif "!bp" in args[0].lower():
        await client.user.party.me.set_battlepass_info(has_purchased=True, level=args[1], self_boost_xp='0', friend_boost_xp='0')

    elif "!level" in args[0].lower():
        await client.user.party.me.set_banner(icon=client.user.party.me.banner[0], color=client.user.party.me.banner[1], season_level=args[1])

    elif "!echo" in args[0].lower():
        await client.user.party.send(content)

    elif "!status" in args[0].lower():
        await client.set_status(content)

        await message.reply(f'Status set to {content}')
        print(f'[PartyBot] [{time()}] Status set to {content}.')

    elif "!leave" in args[0].lower():
        await client.user.party.me.set_emote('EID_Wave')
        await asyncio.sleep(2)
        await client.user.party.me.leave()
        await message.reply('Bye!')
        print(f'[PartyBot] [{time()}] Left the party as I was requested.')

    elif "!kick" in args[0].lower():
        user = await client.fetch_profile(content)
        member = client.user.party.members.get(user.id)
        if member is None:
            await message.reply("Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.kick()
                await message.reply(f"Kicked user: {member.display_name}.")
                print(f"[PartyBot] [{time()}] Kicked user: {member.display_name}")
            except fortnitepy.Forbidden:
                await message.reply(f"Couldn't kick {member.display_name}, as I'm not party leader.")
                print(crayons.red(f"[PartyBot] [{time()}] [ERROR] Failed to kick member as I don't have the required permissions."))

    elif "!promote" in args[0].lower():
        if len(args) != 1:
            user = await client.fetch_profile(content)
            member = client.user.party.members.get(user.id)
        if len(args) == 1:
            user = await client.fetch_profile(message.author.display_name)
            user = await client.user.party.members.get(user.id)

        if member is None:
            await message.reply("Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.promote()
                await message.reply(f"Promoted user: {member.display_name}.")
                print(f"[PartyBot] [{time()}] Promoted user: {member.display_name}")
            except fortnitepy.Forbidden:
                await message.reply(f"Couldn't promote {member.display_name}, as I'm not party leader.")
                print(crayons.red(f"[PartyBot] [{time()}] [ERROR] Failed to promote member as I don't have the required permissions."))

    elif "playlist_" in args[0].lower():
        try:
            await client.user.party.set_playlist(playlist=args[0])
        except fortnitepy.Forbidden:
            await message.reply(f"Couldn't set gamemode to {args[1]}, as I'm not party leader.")
            print(crayons.red(f"[PartyBot] [{time()}] [ERROR] Failed to set gamemode as I don't have the required permissions."))

    elif "!platform" in args[0].lower():
        await message.reply(f'Setting platform to {args[0]}')
        party_id = client.user.party.id
        await client.user.party.me.leave()
        client.platform = fortnitepy.Platform(args[1])
        await message.reply(f'Platform set to {str(client.platform)}.')
        try:
            await client.join_to_party(party_id, check_private=True)
        except fortnitepy.Forbidden:
            await message.reply('Failed to join back as party is set to private.')

    elif args[0].lower() == "!id":
        user = await client.fetch_profile(content, cache=False, raw=False)
        try:
            await message.reply(f"{content}'s Epic ID is: {user.id}")
        except AttributeError:
            await message.reply(f"I couldn't find an Epic account with the name: {content}.")

    elif "!privacy" in args[0].lower():
        try:
            if 'public' in args[1].lower():
                await client.user.party.set_privacy(fortnitepy.PartyPrivacy.PUBLIC)
            elif 'private' in args[1].lower():
                await client.user.party.set_privacy(fortnitepy.PartyPrivacy.PRIVATE)
            elif 'friends' in args[1].lower():
                await client.user.party.set_privacy(fortnitepy.PartyPrivacy.FRIENDS)
            elif 'friends_allow_friends_of_friends' in args[1].lower():
                await client.user.party.set_privacy(fortnitepy.PartyPrivacy.FRIENDS_ALLOW_FRIENDS_OF_FRIENDS)
            elif 'private_allow_friends_of_friends' in args[1].lower():
                await client.user.party.set_privacy(fortnitepy.PartyPrivacy.PRIVATE_ALLOW_FRIENDS_OF_FRIENDS)

            await message.reply(f'Party privacy set to {client.user.party.privacy}.')
            print(f'[PartyBot] [{time()}] Party privacy set to {client.user.party.privacy}.')

        except fortnitepy.Forbidden:
            await message.reply(f"Couldn't set party privacy to {args[1]}, as I'm not party leader.")
            print(crayons.red(f"[PartyBot] [{time()}] [ERROR] Failed to set party privacy as I don't have the required permissions."))

    elif "!copy" in args[0].lower():
        if len(args) >= 1:
            member = client.user.party.members.get(message.author.id)
        else:
            user = await client.fetch_profile(content)
            member = client.user.party.members.get(user.id)

        await client.user.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], self_boost_xp='0', friend_boost_xp='0')
        )

        await client.user.party.me.set_emote(asset=member.emote)
Exemplo n.º 10
0
async def event_friend_message(message):
    args = message.content.split()
    split = args[1:]
    content = " ".join(split)
    print(f'[ZEBBOT] [{getTime()}] {message.author.display_name}: {message.content}')

    if "!skin" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(content, parameter='displayName', sorter='type', filter='Outfit')
        if cosmetic == None:
            await message.reply(f"Couldn't find a skin with the name: {content}")
        else:
            await client.user.party.me.set_outfit(asset=cosmetic.id)
            await message.reply(f'Skin set to {cosmetic.id}')
            print(f"[ZEBBOT] [{getTime()}] Set Skin to: {cosmetic.id}")
        
    elif "!backpack" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(content, parameter='displayName', sorter='type', filter='Back Bling')
        if cosmetic == None:
            await message.reply(f"Couldn't find a backpack with the name: {content}")
        else:
            await client.user.party.me.set_backpack(asset=cosmetic.id)
            await message.reply(f'Backpack set to {cosmetic.id}')
            print(f"[ZEBBOT] [{getTime()}] Set Backpack to: {cosmetic.id}")

    elif "!emote" in args[0].lower():
        await client.user.party.me.clear_emote()
        cosmetic = await BenBotAsync.get_cosmetic(content, parameter='displayName', sorter='type', filter='Emote')
        if cosmetic == None:
            await message.reply(f"Couldn't find a skin with the name: {content}")
        else:
            await client.user.party.me.set_emote(asset=cosmetic.id)
            await message.reply(f'Emote set to {cosmetic.id}')
            print(f"[ZEBBOT] [{getTime()}] Set Emote to: {cosmetic.id}")

    elif "!pickaxe" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(content, parameter='displayName', sorter='type', filter='Harvesting Tool')
        if cosmetic == None:
            await message.reply(f"Couldn't find a pickaxe with the name: {content}")
        else:
            await client.user.party.me.set_pickaxe(asset=cosmetic.id)
            await message.reply(f'Pickaxe set to {cosmetic.id}')
            print(f"[ZEBBOT] [{getTime()}] Set Pickaxe to: {cosmetic.id}")

    elif "!pet" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(content, parameter='displayName', sorter='backendType', filter='AthenaPet')
        await client.user.party.me.set_backpack(asset=f"/Game/Athena/Items/Cosmetics/PetCarriers/{cosmetic.id}.{cosmetic.id}")
        await message.reply(f'Pet set to {cosmetic.id}')
        print(f"[ZEBBOT] [{getTime()}] Set PetCarrier to: {cosmetic.id}")

    elif "!emoji" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(content, parameter='displayName', sorter='backendType', filter='AthenaDance')
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(asset=f"/Game/Athena/Items/Cosmetics/Dances/Emoji/{cosmetic.id}.{cosmetic.id}")
        await message.reply(f'Emoji set to {cosmetic.id}')
        print(f"[ZEBBOT] [{getTime()}] Set Emoji to: {cosmetic.id}")

    elif "!ogskull" in args[0].lower():
        variants = client.user.party.me.create_variants(
           clothing_color=1
        )

        await client.user.party.me.set_outfit(
            asset='CID_030_Athena_Commando_M_Halloween',
            variants=variants
        )

        await message.reply('Skin set to Purple Skull Trooper!')

    elif "!ogghoul" in args[0].lower():
        variants = client.user.party.me.create_variants(
           material=3
        )

        await client.user.party.me.set_outfit(
            asset='CID_029_Athena_Commando_F_Halloween',
            variants=variants
        )

        await message.reply('Skin set to Pink Ghoul Trooper!')

    elif "!ogportal" in args[0].lower():
        variants = client.user.party.me.create_variants(
            item='AthenaBackpack',
            particle_config='Particle',
            particle=1
        )

        await client.user.party.me.set_backpack(
            asset='BID_105_GhostPortal',
            variants=variants
        )

        await message.reply('Backpack set to Purple Ghost Portal!')

    elif "!epic" in args[0].lower():
        await client.user.party.me.set_outfit(
        asset='CID_TBD_Athena_Commando_M_ConstructorTest',
        variants=variants
        )
        await client.user.party.me.set_banner(
        icon='otherbanner28',
        color='defaultcolor',
        season_level='100000')

        await message.reply('Epic Mode On!')

    elif "!epic2" in args[0].lower():
        await client.user.party.me.set_outfit(
        asset='CID_TBD_Athena_Commando_F_ConstructorTest',
        variants=variants
        )
        await client.user.party.me.set_banner(
        icon='otherbanner28',
        color='defaultcolor',
        season_level='6969')

        await message.reply('Epic 2 Mode On!')

    elif "!ikonik" in args[0].lower():
        await client.user.party.me.set_outfit(
        asset='CID_313_Athena_Commando_M_KpopFashion',
        variants=variants
        )

        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
        asset='EID_KPopDance03')
        await message.reply(f'Skin set to CID_313_Athena_Commando_M_KpopFashion')
        await message.reply(f'Emote set to EID_KPopDance03')

    elif "!glow" in args[0].lower():
        await client.user.party.me.set_outfit(
        asset='CID_479_Athena_Commando_F_Davinci',
        variants=variants
        )

        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
        asset='EID_Davinci')
        await message.reply(f'Skin set to CID_479_Athena_Commando_F_Davinci')
        await message.reply(f'Emote set to EID_Davinci')

    elif "!floss" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
        asset='EID_Floss')
        await message.reply(f'Emote set to EID_Floss')

    elif "!worm" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
        asset='EID_Worm')
        await message.reply(f'Emote set to EID_Worm')

    elif "!l" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
        asset='EID_TakeTheL')
        await message.reply(f'Emote set to EID_TakeTheL')

    elif "!ride" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
        asset='EID_RideThePony_Athena')
        await message.reply(f'Emote set to EID_RideThePony_Athena')

    elif "!dab" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
        asset='EID_Dab')
        await message.reply(f'Emote set to EID_Dab')

    elif "!infdab" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
        asset='EID_InfiniteDab')
        await message.reply(f'Emote set to EID_InfiniteDab')

    elif "!lvl" in args[0].lower():
        await client.user.party.me.set_banner(
        season_level=args[1])
        await message.reply(f'Level set to {args[1]}')

    elif "!banner" in args[0].lower():
        if len(args) == 1:
            await message.reply('You need to specifiy which banner, color & level you want to set the banner as.')
        if len(args) == 2:
            await client.user.party.me.set_banner(icon=args[1], color=data['banner_colour'], season_level=data['level'])
        if len(args) == 3:
            await client.user.party.me.set_banner(icon=args[1], color=args[2], season_level=data['level'])
        if len(args) == 4:
            await client.user.party.me.set_banner(icon=args[1], color=args[2], season_level=args[3])

        await message.reply(f'Banner set to; {args[1]} {args[2]} {args[3]}')
        print(f"[ZEBBOT] [{getTime()}] Banner set to; {args[1]} {args[2]} {args[3]}")

    elif "cid_" in args[0].lower():
        await client.user.party.me.set_outfit(
            asset=args[0]
        )

        await message.reply(f'Skin set to {args[0]}')
        await print(f'[ZEBBOT] [{getTime()}] Skin set to {args[0]}')

    elif "vtid_" in args[0].lower():
        VTID = await setVTID(args[0])
        if VTID[1] == 'Particle':
            variants = client.user.party.me.create_variants(particle_config='Particle', particle=1)
        else:
            variants = client.user.party.me.create_variants(**{VTID[1].lower(): int(VTID[2])})

        await client.user.party.me.set_outfit(asset=VTID[0], variants=variants)
        await message.reply(f'Variants set to {args[0]}.\n(Warning: This feature is not supported, please use !variants)')

    elif "!variants" in args[0]:
        args3 = int(args[3])

        if 'cid' in args[1].lower():
            variants = client.user.party.me.create_variants(**{args[2]: args3})
            await client.user.party.me.set_outfit(
                asset=args[1],
                variants=variants
            )
        elif 'bid' in args[1].lower():
            variants = client.user.party.me.create_variants(item='AthenaBackpack', **{args[2]: args3})
            await client.user.party.me.set_backpack(
                asset=args[1],
                variants=variants
            )
        elif 'pickaxe_id' in args[1].lower():
            variants = client.user.party.me.create_variants(item='AthenaPickaxe', **{args[2]: args3})
            await client.user.party.me.set_pickaxe(
                asset=args[1],
                variants=variants
            )

        await message.reply(f'Set variants of {args[1]} to {args[2]} {args[3]}.')
        print(f'[ZEBBOT] [{getTime()}] Set variants of {args[1]} to {args[2]} {args[3]}.')

    elif "!ogrenegade" in args[0].lower():
        variants = client.user.party.me.create_variants(
           material=2
        )

        await client.user.party.me.set_outfit(
            asset='CID_028_Athena_Commando_F',
            variants=variants
        )

        await message.reply('Skin set to Checkered Renegade!')

    elif "!mintyelf" in args[0].lower():
        variants = client.user.party.me.create_variants(
           material=2
        )

        await client.user.party.me.set_outfit(
            asset='CID_051_Athena_Commando_M_HolidayElf',
            variants=variants
        )

        await message.reply('Skin set to Minty Elf!')

    elif "eid_" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
            asset=args[0]
        )
        await message.reply(f'Emote set to {args[0]}!')
        
    elif "!stop" in args[0].lower():
        await client.user.party.me.clear_emote()
        await message.reply('Stopped emoting.')

    elif "bid_" in args[0].lower():
        await client.user.party.me.set_backpack(
            asset=args[0]
        )

        await message.reply(f'Backbling set to {args[0]}!')

    elif "!help" in args[0].lower():
        await message.reply('Opening Command List... Please wait...')
        webbrowser.open('http://botcommandlist.herokuapp.com/index.html')

    elif "PICKAXE_ID_" in args[0].lower():
        await client.user.party.me.set_pickaxe(
                asset=args[0]
        )

        await message.reply(f'Pickaxe set to {args[0]}')

    elif "petcarrier_" in args[0].lower():
        await client.user.party.me.set_backpack(
                asset=f"/Game/Athena/Items/Cosmetics/PetCarriers/{args[0]}.{args[0]}"
        )

    elif "emoji_" in args[0].lower():
        await client.user.party.me.set_emote(asset='EID_ClearEmote')
        await client.user.party.me.set_emote(
                asset=f"/Game/Athena/Items/Cosmetics/Dances/Emoji/{args[0]}.{args[0]}"
        )

    elif "!legacypickaxe" in args[0].lower():
        await client.user.party.me.set_pickaxe(
                asset=args[1]
        )

        await message.reply(f'Pickaxe set to {args[1]}!')

    elif "!point" in args[0].lower():
        if 'PICKAXE_ID' in args[1]:
            await client.user.party.me.set_pickaxe(asset=args[1])
            await client.user.party.me.set_emote(asset='EID_IceKing')
            await message.reply(f'Pickaxe set to {args[1]} & Point it Out played.')
        else:
            cosmetic = await BenBotAsync.get_cosmetic(content, parameter='displayName', sorter='type', filter='Harvesting Tool')
            if cosmetic == None:
                await message.reply(f"Couldn't find a pickaxe with the name: {content}")
            else:
                await client.user.party.me.set_pickaxe(asset=cosmetic.id)
                await client.user.party.me.set_emote(asset='EID_IceKing')
                await message.reply(f'Pickaxe set to {content} & Point it Out played.')


    elif "!ready" in args[0].lower():
        await client.user.party.me.set_ready(True)
        await message.reply('Ready!')

    elif ("!unready" in args[0].lower()) or ("!sitin" in args[0].lower()):
        await client.user.party.me.set_ready(False)
        await message.reply('Unready!')

    elif "!sitout" in args[0].lower():
        await client.user.party.me.set_ready(None)
        await message.reply('Sitting Out!')

    elif "!bp" in args[0].lower():
        await client.user.party.me.set_battlepass_info(has_purchased=True, level=args[1], self_boost_xp='0', friend_boost_xp='0')

    elif "!level" in args[0].lower():
        await client.user.party.me.set_banner(icon=client.user.party.me.banner[0], color=client.user.party.me.banner[1], season_level=args[1])

    elif "!echo" in args[0].lower():
        await client.user.party.send(content)

    elif "!status" in args[0].lower():
        await client.set_status(content)

        await message.reply(f'Status set to {content}')
        print(f'[ZEBBOT] [{getTime()}] Status set to {content}.')

    elif "!leave" in args[0].lower():
        await client.user.party.me.set_emote('EID_Wave')
        await asyncio.sleep(2)
        await client.user.party.me.leave()
        await message.reply('Bye!')
        print(f'[ZEBBOT] [{getTime()}] Left the party as I was requested.')

    elif "!kick" in args[0].lower():
        user = await client.fetch_profile(content)
        member = client.user.party.members.get(user.id)
        if member is None:
            await message.reply("Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.kick()
                await message.reply(f"Kicked user: {member.display_name}.")
                print(f"[ZEBBOT] [{getTime()}] Kicked user: {member.display_name}")
            except fortnitepy.PartyPermissionError:
                await message.reply(f"Couldn't kick {member.display_name}, as I'm not party leader.")
                print(crayons.red(f"[ZEBBOT] [{getTime()}] [ERROR] Failed to kick member as I don't have the required permissions."))

    elif "!promote" in args[0].lower():
        if len(args) != 1:
            user = await client.fetch_profile(content)
            member = client.user.party.members.get(user.id)
        if len(args) == 1:
            user = await client.fetch_profile(message.author.display_name)
            user = await client.user.party.members.get(user.id)

        if member is None:
            await message.reply("Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.promote()
                await message.reply(f"Promoted user: {member.display_name}.")
                print(f"[ZEBBOT] [{getTime()}] Promoted user: {member.display_name}")
            except fortnitepy.PartyPermissionError:
                await message.reply(f"Couldn't promote {member.display_name}, as I'm not party leader.")
                print(crayons.red(f"[ZEBBOT] [{getTime()}] [ERROR] Failed to promote member as I don't have the required permissions."))

    elif "Playlist_" in args[0]:
        try:
            await client.user.party.set_playlist(playlist=args[0])
        except fortnitepy.PartyPermissionError:
                await message.reply(f"Couldn't set gamemode to {args[1]}, as I'm not party leader.")
                print(crayons.red(f"[ZEBBOT] [{getTime()}] [ERROR] Failed to set gamemode as I don't have the required permissions."))

    elif "!platform" in args[0]:
        await message.reply(f'Setting platform to {args[0]}')
        party_id = client.user.party.id
        await client.user.party.me.leave()
        client.platform = fortnitepy.Platform(args[1])
        await message.reply(f'Platform set to {str(client.platform)}.')
        try:
            await client.join_to_party(party_id, check_private=True)
        except fortnitepy.Forbidden:
            await message.reply('Failed to join back as party is set to private.')

    elif args[0] == "!id":
        user = await client.fetch_profile(content, cache=False, raw=False)
        try:
            await message.reply(f"{content}'s Epic ID is: {user.id}")
        except AttributeError:
            await message.reply(f"I couldn't find an Epic account with the name: {content}.")

    elif "!crash" in args[0].lower():
        await message.reply(f'Attempting to crash lobby!')
        await client.user.party.me.set_banner(season_level='696969696969696969')
        await client.user.party.me.set_ready(True)
        await client.set_status('Crashing Current Lobby!!')
        variants = client.user.party.me.create_variants(material=2)
        await client.user.party.me.set_outfit(asset='CID_051_Athena_Commando_M_HolidayElf',variants=variants)
        await client.user.party.me.set_banner(season_level='-100001001010101101')
        await client.user.party.me.set_ready(False)
        await client.set_status('Crashing Current Lobby!!')
        variants = client.user.party.me.create_variants(material=2)
        await client.user.party.me.set_outfit(asset='CID_028_Athena_Commando_F',variants=variants)
        await client.user.party.me.set_banner(season_level='696969696969696969')
        await client.user.party.me.set_ready(True)
        await client.set_status('Crashing Current Lobby!')
        await client.user.party.me.set_outfit(asset='CID_TBD_Athena_Commando_F_ConstructorTest',variants=variants)
        variants = client.user.party.me.create_variants(material=2)
        await client.user.party.me.set_banner(season_level='-1000010010101011010')
        await client.user.party.me.set_ready(False)
        await client.set_status('Crashing Current Lobby!!')
        variants = client.user.party.me.create_variants(clothing_color=1)
        await client.user.party.me.set_outfit(asset='CID_030_Athena_Commando_M_Halloween',variants=variants)
        await client.user.party.me.set_banner(season_level='-100001001010101101')
        await client.user.party.me.set_ready(False)
        await client.set_status('Crashing Current Lobby!!')
        variants = client.user.party.me.create_variants(material=3)
        await client.user.party.me.set_outfit(asset='CID_029_Athena_Commando_F_Halloween',variants=variants)
        variants = client.user.party.me.create_variants(item='AthenaBackpack',particle_config='Particle',particle=1)
        await client.user.party.me.set_backpack(asset='BID_105_GhostPortal',variants=variants)
        await client.user.party.me.set_banner(season_level='696969696969696969')
        await client.user.party.me.set_ready(True)
        await client.set_status('Crashing Current Lobby!!')
        await message.reply(f'Attemped crash!')
Exemplo n.º 11
0
async def event_friend_message(message: fortnitepy.FriendMessage) -> None:
    args = message.content.split()
    split = args[1:]
    content = " ".join(split)

    print(
        f'[PartyBot] [{time()}] {message.author.display_name}: {message.content}'
    )

    if "!skin" in args[0].lower():
        try:
            cosmetic = await BenBotAsync.get_cosmetic(
                lang="en",
                searchLang="en",
                matchMethod="contains",
                name=content,
                backendType="AthenaCharacter")

            await message.reply(f'Skin set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set skin to: {cosmetic.id}.")
            await client.user.party.me.set_outfit(asset=cosmetic.id)

        except BenBotAsync.exceptions.NotFound:
            await message.reply(
                f"Couldn't find a skin with the name: {content}.")
            print(
                f"[PartyBot] [{time()}] Couldn't find a skin with the name: {content}."
            )

    elif "!backpack" in args[0].lower():
        try:
            cosmetic = await BenBotAsync.get_cosmetic(
                lang="en",
                searchLang="en",
                matchMethod="contains",
                name=content,
                backendType="AthenaBackpack")

            await message.reply(f'Backpack set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set backpack to: {cosmetic.id}.")
            await client.user.party.me.set_backpack(asset=cosmetic.id)

        except BenBotAsync.exceptions.NotFound:
            await message.reply(
                f"Couldn't find a backpack with the name: {content}.")
            print(
                f"[PartyBot] [{time()}] Couldn't find a backpack with the name: {content}."
            )

    elif "!emote" in args[0].lower():
        try:
            cosmetic = await BenBotAsync.get_cosmetic(
                lang="en",
                searchLang="en",
                matchMethod="contains",
                name=content,
                backendType="AthenaDance")

            await message.reply(f'Emote set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set emote to: {cosmetic.id}.")
            await client.user.party.me.clear_emote()
            await client.user.party.me.set_emote(asset=cosmetic.id)

        except BenBotAsync.exceptions.NotFound:
            await message.reply(
                f"Couldn't find an emote with the name: {content}.")
            print(
                f"[PartyBot] [{time()}] Couldn't find an emote with the name: {content}."
            )

    elif "!pickaxe" in args[0].lower():
        try:
            cosmetic = await BenBotAsync.get_cosmetic(
                lang="en",
                searchLang="en",
                matchMethod="contains",
                name=content,
                backendType="AthenaPickaxe")

            await message.reply(f'Pickaxe set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set pickaxe to: {cosmetic.id}.")
            await client.user.party.me.set_pickaxe(asset=cosmetic.id)

        except BenBotAsync.exceptions.NotFound:
            await message.reply(
                f"Couldn't find a pickaxe with the name: {content}.")
            print(
                f"[PartyBot] [{time()}] Couldn't find a pickaxe with the name: {content}."
            )

    elif "!pet" in args[0].lower():
        try:
            cosmetic = await BenBotAsync.get_cosmetic(lang="en",
                                                      searchLang="en",
                                                      matchMethod="contains",
                                                      name=content,
                                                      backendType="AthenaPet")

            await message.reply(f'Pet set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set pet to: {cosmetic.id}.")
            await client.user.party.me.set_pet(asset=cosmetic.id)

        except BenBotAsync.exceptions.NotFound:
            await message.reply(
                f"Couldn't find a pet with the name: {content}.")
            print(
                f"[PartyBot] [{time()}] Couldn't find a pet with the name: {content}."
            )

    elif "!emoji" in args[0].lower():
        try:
            cosmetic = await BenBotAsync.get_cosmetic(
                lang="en",
                searchLang="en",
                matchMethod="contains",
                name=content,
                backendType="AthenaEmoji")

            await message.reply(f'Pet set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set pet to: {cosmetic.id}.")
            await client.user.party.me.set_emoji(asset=cosmetic.id)

        except BenBotAsync.exceptions.NotFound:
            await message.reply(
                f"Couldn't find an emoji with the name: {content}.")
            print(
                f"[PartyBot] [{time()}] Couldn't find an emoji with the name: {content}."
            )

    elif "!contrail" in args[0].lower():
        try:
            cosmetic = await BenBotAsync.get_cosmetic(
                lang="en",
                searchLang="en",
                matchMethod="contains",
                name=content,
                backendType="AthenaSkyDiveContrail")

            await message.reply(f'Contrail set to {cosmetic.id}.')
            print(f"[PartyBot] [{time()}] Set contrail to: {cosmetic.id}.")
            await client.user.party.me.set_contrail(asset=cosmetic.id)

        except BenBotAsync.exceptions.NotFound:
            await message.reply(
                f"Couldn't find a contrail with the name: {content}.")
            print(
                f"[PartyBot] [{time()}] Couldn't find an contrail with the name: {content}."
            )

    elif "!purpleskull" in args[0].lower():
        variants = client.user.party.me.create_variants(clothing_color=1)

        await client.user.party.me.set_outfit(
            asset='CID_030_Athena_Commando_M_Halloween', variants=variants)

        await message.reply('Skin set to Purple Skull Trooper!')

    elif "!pinkghoul" in args[0].lower():
        variants = client.user.party.me.create_variants(material=3)

        await client.user.party.me.set_outfit(
            asset='CID_029_Athena_Commando_F_Halloween', variants=variants)

        await message.reply('Skin set to Pink Ghoul Trooper!')

    elif "!purpleportal" in args[0].lower():
        variants = client.user.party.me.create_variants(
            item='AthenaBackpack', particle_config='Particle', particle=1)

        await client.user.party.me.set_backpack(asset='BID_105_GhostPortal',
                                                variants=variants)

        await message.reply('Backpack set to Purple Ghost Portal!')

    elif "!banner" in args[0].lower():
        await client.user.party.me.set_banner(icon=args[1],
                                              color=args[2],
                                              season_level=args[3])

        await message.reply(f'Banner set to: {args[1]}, {args[2]}, {args[3]}.')
        print(
            f"[PartyBot] [{time()}] Banner set to: {args[1]}, {args[2]}, {args[3]}."
        )

    elif "cid_" in args[0].lower():
        if 'banner' not in args[0].lower():
            await client.user.party.me.set_outfit(asset=args[0])
        else:
            await client.user.party.me.set_outfit(
                asset=args[0],
                variants=client.user.party.me.create_variants(
                    profile_banner='ProfileBanner'))

        await message.reply(f'Skin set to {args[0]}')
        print(f'[PartyBot] [{time()}] Skin set to {args[0]}')

    elif "vtid_" in args[0].lower():
        vtid = await set_vtid(args[0])
        if vtid[1] == 'Particle':
            variants = client.user.party.me.create_variants(
                particle_config='Particle', particle=1)
        else:
            variants = client.user.party.me.create_variants(
                **{vtid[1].lower(): int(vtid[2])})

        await client.user.party.me.set_outfit(asset=vtid[0], variants=variants)
        await message.reply(
            f'Variants set to {args[0]}.\n'
            '(Warning: This feature is not supported, please use !variants)')

    elif "!variants" in args[0].lower():
        try:
            args3 = int(args[3])
        except ValueError:
            args3 = args[3]

        if 'cid' in args[1].lower() and 'jersey_color' not in args[2]:
            variants = client.user.party.me.create_variants(
                **{args[2]: args[3]})
            await client.user.party.me.set_outfit(asset=args[1],
                                                  variants=variants)
        elif 'cid' in args[1].lower() and 'jersey_color' in args[2]:
            variants = client.user.party.me.create_variants(
                pattern=0, numeric=69, **{args[2]: args[3]})
            await client.user.party.me.set_outfit(asset=args[1],
                                                  variants=variants)
        elif 'bid' in args[1].lower():
            variants = client.user.party.me.create_variants(
                item='AthenaBackpack', **{args[2]: args3})
            await client.user.party.me.set_backpack(asset=args[1],
                                                    variants=variants)
        elif 'pickaxe_id' in args[1].lower():
            variants = client.user.party.me.create_variants(
                item='AthenaPickaxe', **{args[2]: args3})
            await client.user.party.me.set_pickaxe(asset=args[1],
                                                   variants=variants)

        await message.reply(
            f'Set variants of {args[1]} to {args[2]} {args[3]}.')
        print(
            f'[PartyBot] [{time()}] Set variants of {args[1]} to {args[2]} {args[3]}.'
        )

    elif "!checkeredrenegade" in args[0].lower():
        variants = client.user.party.me.create_variants(material=2)

        await client.user.party.me.set_outfit(
            asset='CID_028_Athena_Commando_F', variants=variants)

        await message.reply('Skin set to Checkered Renegade!')

    elif "!mintyelf" in args[0].lower():
        variants = client.user.party.me.create_variants(material=2)

        await client.user.party.me.set_outfit(
            asset='CID_051_Athena_Commando_M_HolidayElf', variants=variants)

        await message.reply('Skin set to Minty Elf!')

    elif "eid_" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(asset=args[0])
        await message.reply(f'Emote set to {args[0]}!')

    elif "!stop" in args[0].lower():
        await client.user.party.me.clear_emote()
        await message.reply('Stopped emoting.')

    elif "bid_" in args[0].lower():
        await client.user.party.me.set_backpack(asset=args[0])

        await message.reply(f'Backbling set to {args[0]}!')

    elif "!help" in args[0].lower():
        await message.reply(
            'For a list of commands, goto; https://github.com/xMistt/fortnitepy-bot/wiki/Commands'
        )

    elif "PICKAXE_ID_" in args[0].lower():
        await client.user.party.me.set_pickaxe(asset=args[0])

        await message.reply(f'Pickaxe set to {args[0]}')

    elif "petcarrier_" in args[0].lower():
        await client.user.party.me.set_pet(asset=args[0])

        await message.reply(f'Pet set to {args[0]}!')

    elif "emoji_" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emoji(asset=args[0])

        await message.reply(f'Emoji set to {args[0]}!')

    elif "trails_" in args[0].lower():
        await client.user.party.me.set_contrail(asset=args[0])

        await message.reply(f'Contrail set to {args[0]}!')

    elif "!legacypickaxe" in args[0].lower():
        await client.user.party.me.set_pickaxe(asset=args[1])

        await message.reply(f'Pickaxe set to {args[1]}!')

    elif "!point" in args[0].lower():
        if 'pickaxe_id' in args[1].lower():
            await client.user.party.me.set_pickaxe(asset=args[1])
            await client.user.party.me.set_emote(asset='EID_IceKing')
            await message.reply(
                f'Pickaxe set to {args[1]} & Point it Out played.')
        else:
            try:
                cosmetic = await BenBotAsync.get_cosmetic(
                    lang="en",
                    searchLang="en",
                    matchMethod="contains",
                    name=content,
                    backendType="AthenaPickaxe")

                await client.user.party.me.set_pickaxe(asset=cosmetic.id)
                await client.user.party.me.clear_emote()
                await client.user.party.me.set_emote(asset='EID_IceKing')
                await message.reply(
                    f'Pickaxe set to {content} & Point it Out played.')
            except BenBotAsync.exceptions.NotFound:
                await message.reply(
                    f"Couldn't find a pickaxe with the name: {content}")

    elif "!ready" in args[0].lower():
        await client.user.party.me.set_ready(fortnitepy.ReadyState.READY)
        await message.reply('Ready!')

    elif ("!unready" in args[0].lower()) or ("!sitin" in args[0].lower()):
        await client.user.party.me.set_ready(fortnitepy.ReadyState.NOT_READY)
        await message.reply('Unready!')

    elif "!sitout" in args[0].lower():
        await client.user.party.me.set_ready(fortnitepy.ReadyState.SITTING_OUT)
        await message.reply('Sitting Out!')

    elif "!bp" in args[0].lower():
        await client.user.party.me.set_battlepass_info(
            has_purchased=True,
            level=args[1],
        )

    elif "!level" in args[0].lower():
        await client.user.party.me.set_banner(
            icon=client.user.party.me.banner[0],
            color=client.user.party.me.banner[1],
            season_level=args[1])

    elif "!echo" in args[0].lower():
        await client.user.party.send(content)

    elif "!status" in args[0].lower():
        await client.set_status(content)

        await message.reply(f'Status set to {content}')
        print(f'[PartyBot] [{time()}] Status set to {content}.')

    elif "!leave" in args[0].lower():
        await client.user.party.me.set_emote('EID_Wave')
        await asyncio.sleep(2)
        await client.user.party.me.leave()
        await message.reply('Bye!')
        print(f'[PartyBot] [{time()}] Left the party as I was requested.')

    elif "!kick" in args[0].lower():
        user = await client.fetch_profile(content)
        member = client.user.party.members.get(user.id)
        if member is None:
            await message.reply(
                "Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.kick()
                await message.reply(f"Kicked user: {member.display_name}.")
                print(
                    f"[PartyBot] [{time()}] Kicked user: {member.display_name}"
                )
            except fortnitepy.Forbidden:
                await message.reply(
                    f"Couldn't kick {member.display_name}, as I'm not party leader."
                )
                print(
                    crayons.red(
                        f"[PartyBot] [{time()}] [ERROR] "
                        "Failed to kick member as I don't have the required permissions."
                    ))

    elif "!promote" in args[0].lower():
        if len(args) == 1:
            user = await client.fetch_profile(message.author.display_name)
            member = await client.user.party.members.get(user.id)
        else:
            user = await client.fetch_profile(content)
            member = client.user.party.members.get(user.id)

        if member is None:
            await message.reply(
                "Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.promote()
                await message.reply(f"Promoted user: {member.display_name}.")
                print(
                    f"[PartyBot] [{time()}] Promoted user: {member.display_name}"
                )
            except fortnitepy.Forbidden:
                await message.reply(
                    f"Couldn't promote {member.display_name}, as I'm not party leader."
                )
                print(
                    crayons.red(
                        f"[PartyBot] [{time()}] [ERROR] "
                        "Failed to kick member as I don't have the required permissions."
                    ))

    elif "playlist_" in args[0].lower():
        try:
            await client.user.party.set_playlist(playlist=args[0])
        except fortnitepy.Forbidden:
            await message.reply(
                f"Couldn't set gamemode to {args[1]}, as I'm not party leader."
            )
            print(
                crayons.red(
                    f"[PartyBot] [{time()}] [ERROR] "
                    "Failed to set gamemode as I don't have the required permissions."
                ))

    elif "!platform" in args[0].lower():
        await message.reply(f'Setting platform to {args[0]}')
        party_id = client.user.party.id
        await client.user.party.me.leave()
        client.platform = fortnitepy.Platform(args[1])
        await message.reply(f'Platform set to {str(client.platform)}.')
        try:
            await client.join_to_party(party_id)
        except fortnitepy.Forbidden:
            await message.reply(
                'Failed to join back as party is set to private.')

    elif "!id" in args[0].lower():
        user = await client.fetch_profile(content, cache=False, raw=False)
        try:
            await message.reply(f"{content}'s Epic ID is: {user.id}")
        except AttributeError:
            await message.reply(
                f"I couldn't find an Epic account with the name: {content}.")

    elif "!privacy" in args[0].lower():
        try:
            if 'public' in args[1].lower():
                await client.user.party.set_privacy(
                    fortnitepy.PartyPrivacy.PUBLIC)
            elif 'private' in args[1].lower():
                await client.user.party.set_privacy(
                    fortnitepy.PartyPrivacy.PRIVATE)
            elif 'friends' in args[1].lower():
                await client.user.party.set_privacy(
                    fortnitepy.PartyPrivacy.FRIENDS)
            elif 'friends_allow_friends_of_friends' in args[1].lower():
                await client.user.party.set_privacy(
                    fortnitepy.PartyPrivacy.FRIENDS_ALLOW_FRIENDS_OF_FRIENDS)
            elif 'private_allow_friends_of_friends' in args[1].lower():
                await client.user.party.set_privacy(
                    fortnitepy.PartyPrivacy.PRIVATE_ALLOW_FRIENDS_OF_FRIENDS)

            await message.reply(
                f'Party privacy set to {client.user.party.privacy}.')
            print(
                f'[PartyBot] [{time()}] Party privacy set to {client.user.party.privacy}.'
            )

        except fortnitepy.Forbidden:
            await message.reply(
                f"Couldn't set party privacy to {args[1]}, as I'm not party leader."
            )
            print(
                crayons.red(
                    f"[PartyBot] [{time()}] [ERROR] "
                    "Failed to set party privacy as I don't have the required permissions."
                ))

    elif "!copy" in args[0].lower():
        if len(args) >= 1:
            member = client.user.party.members.get(message.author.id)
        else:
            user = await client.fetch_profile(content)
            member = client.user.party.members.get(user.id)

        await client.user.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]))

        await client.user.party.me.set_emote(asset=member.emote)

    elif "!hologram" in args[0].lower():
        await client.user.party.me.set_outfit(
            asset='CID_VIP_Athena_Commando_M_GalileoGondola_SG')

        await message.reply('Skin set to Star Wars Hologram!')

    elif "!gift" in args[0].lower():
        await client.user.party.me.clear_emote()

        await client.user.party.me.set_emote(asset='EID_NeverGonna')

        await message.reply('What did you think would happen?')

    elif "!matchmakingcode" in args[0].lower():
        await client.user.party.set_custom_key(key=content)

        await message.reply(f'Custom matchmaking code set to: {content}')

    elif "!ninja" in args[0].lower():
        await client.user.party.me.set_outfit(
            asset='CID_605_Athena_Commando_M_TourBus')

        await message.reply('Skin set to Ninja!')

    elif "!ponpon" in args[0].lower():
        await client.user.party.me.set_emote(asset='EID_TourBus')

        await message.reply('Emote set to Ninja Style!')

    elif "!enlightened" in args[0].lower():
        await client.user.party.me.set_outfit(
            asset=args[1],
            variants=client.user.party.me.create_variants(progressive=4),
            enlightenment=(args[2], args[3]))

        await message.reply(
            f'Skin set to {args[1]} at level {args[3]} (for Season 1{args[2]}).'
        )

    elif "!rareskins" in args[0].lower():
        rare_skins = ('CID_028_Athena_Commando_F', 'CID_017_Athena_Commando_M',
                      'CID_022_Athena_Commando_F')
        await message.reply('Showing all rare skins now.')

        await client.user.party.me.set_outfit(
            asset='CID_030_Athena_Commando_M_Halloween',
            variants=client.user.party.me.create_variants(clothing_color=1))

        await message.reply('Skin set to Purple Skull Trooper!')
        await asyncio.sleep(2)

        await client.user.party.me.set_outfit(
            asset='CID_029_Athena_Commando_F_Halloween',
            variants=client.user.party.me.create_variants(material=3))

        await message.reply('Skin set to Pink Ghoul Trooper!')
        await asyncio.sleep(2)

        for skin in rare_skins:
            await client.user.party.me.set_outfit(asset=skin)

            await message.reply(f'Skin set to {skin}!')
            await asyncio.sleep(2)

    elif "!goldenpeely" in args[0].lower():
        await client.user.party.me.set_outfit(
            asset='CID_701_Athena_Commando_M_BananaAgent',
            variants=client.user.party.me.create_variants(progressive=4),
            enlightenment=(2, 350))

        await message.reply(f'Skin set to Golden Peely.')

    elif "!random" in args[0].lower():
        outfits = await BenBotAsync.get_cosmetics(
            lang="en", searchLang="en", backendType="AthenaCharacter")

        skin = random.choice(outfits).id

        await client.user.party.me.set_outfit(
            asset=skin,
            variants=client.user.party.me.create_variants(
                profile_banner='ProfileBanner'))

        await message.reply(f'Skin randomly set to {skin}.')
Exemplo n.º 12
0
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():

    os.system("cls||clear")
    print(intro)
    print(Fore.LIGHTBLUE_EX + " • " + Fore.RESET + "Client is called " +
          Fore.LIGHTBLUE_EX + f"{client.user.display_name}")
Exemplo n.º 13
0
# Device Auth Details #
def store_details(details: dict):
    global config
    for d in details:
        config['Authorization'][d] = details[d]
    yaml.safe_dump(config, open("config.yml", "w"))


# 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'],
Exemplo n.º 14
0
async def event_friend_message(message):
    args = message.content.split()
    split = args[1:]
    joinedArguments = " ".join(split)
    time = datetime.datetime.now().strftime('%H:%M:%S')
    print(' [PYBOT] [' + time +
          '] {0.author.display_name}: {0.content}'.format(message))

    if "!skin" in args[0].lower():
        id = await BenBotAsync.getSkinId(joinedArguments)
        if id == None:
            await message.reply(
                f"Couldn't find a skin with the name: {joinedArguments}")
        else:
            await client.user.party.me.set_outfit(asset=id)
            await message.reply('Skin set to ' + id)
            time = datetime.datetime.now().strftime('%H:%M:%S')
            print(f" [PYBOT] [{time}] Set Skin to: " + id)

    if "!backpack" in args[0].lower():
        if len(args) == 1:
            await client.user.party.me.set_backpack(asset='none')
            await message.reply('Backpack set to None')
            time = datetime.datetime.now().strftime('%H:%M:%S')
            print(f" [PYBOT] [{time}] Set Backpack to None")
        else:
            id = await BenBotAsync.getBackpackId(joinedArguments)
            if id == None:
                await message.reply(
                    f"Couldn't find a backpack with the name: {joinedArguments}"
                )
            else:
                await client.user.party.me.set_backpack(asset=id)
                await message.reply('Backpack set to ' + id)
                time = datetime.datetime.now().strftime('%H:%M:%S')
                print(f" [PYBOT] [{time}] Set Backpack to: " + id)

    if "!emote" in args[0].lower():
        await client.user.party.me.clear_emote()
        id = await BenBotAsync.getEmoteId(joinedArguments)
        if id == None:
            await message.reply(
                f"Couldn't find an emote with the name: {joinedArguments}")
        else:
            await client.user.party.me.set_emote(asset=id)
            await message.reply('Emote set to ' + id)
            time = datetime.datetime.now().strftime('%H:%M:%S')
            print(f" [PYBOT] [{time}] Set Emote to: " + id)

    if "!pickaxe" in args[0].lower():
        id = await BenBotAsync.getPickaxeId(joinedArguments)
        if id == None:
            await message.reply(
                f"Couldn't find a pickaxe with the name: {joinedArguments}")
        else:
            await client.user.party.me.set_pickaxe(asset=id)
            await message.reply('Pickaxe set to ' + id)
            time = datetime.datetime.now().strftime('%H:%M:%S')
            print(f" [PYBOT] [{time}] Set Pickaxe to: " + id)

    if "!point" in args[0].lower():
        await client.user.party.me.clear_emote()
        id = await BenBotAsync.getPickaxeId(joinedArguments)
        if id == None:
            await message.reply(
                f"Couldn't find a pickaxe with the name: {joinedArguments}")
        else:
            await client.user.party.me.set_pickaxe(asset=id)
            await client.user.party.me.set_emote(
                asset=
                "/Game/Athena/Items/Cosmetics/Dances/EID_IceKing.EID_IceKing")
            await message.reply('Pointing with ' + id)
            time = datetime.datetime.now().strftime('%H:%M:%S')
            print(f" [PYBOT] [{time}] Pointing a pickaxe with: " + id)

    if "!pet" in args[0].lower():
        id = await BenBotAsync.getPetId(joinedArguments)
        await client.user.party.me.set_backpack(
            asset="/Game/Athena/Items/Cosmetics/PetCarriers/" + id + "." + id)

        await message.reply('Pet set to ' + id)
        time = datetime.datetime.now().strftime('%H:%M:%S')
        print(f" [PYBOT] [{time}] Client's PetCarrier set to: " + id)

    if "!emoji" in args[0].lower():
        id = await fetch_cosmetic_id(' '.join(split), 'AthenaDance')
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
            asset="/Game/Athena/Items/Cosmetics/Dances/Emoji/" + id + "." + id)

        await message.reply('Emoji set to ' + id)
        time = datetime.datetime.now().strftime('%H:%M:%S')
        print(f" [PYBOT] [{time}] Client's Emoji set to " + id)

    if "!purpleskull" in args[0].lower():
        variants = client.user.party.me.create_variants(clothing_color=1)

        await client.user.party.me.set_outfit(
            asset='CID_030_Athena_Commando_M_Halloween', variants=variants)

        await message.reply('Skin set to Purple Skull Trooper!')
        time = datetime.datetime.now().strftime('%H:%M:%S')
        print(f" [PYBOT] [{time}] Client's Skin set to Purple Skull Trooper")

    if "!pinkghoul" in args[0].lower():
        variants = client.user.party.me.create_variants(material=3)

        await client.user.party.me.set_outfit(
            asset='CID_029_Athena_Commando_F_Halloween', variants=variants)

        await message.reply('Skin set to Pink Ghoul Trooper!')
        time = datetime.datetime.now().strftime('%H:%M:%S')
        print(f" [PYBOT] [{time}] Client's Skin set to Pink Ghoul Trooper")

    if "!brainiacghoul" in args[0].lower():
        variants = client.user.party.me.create_variants(material=2)

        await client.user.party.me.set_outfit(
            asset='CID_029_Athena_Commando_F_Halloween', variants=variants)

        await message.reply('Skin set to Brainiac Ghoul Trooper!')
        time = datetime.datetime.now().strftime('%H:%M:%S')
        print(f" [PYBOT] [{time}] Client's Skin set to Brainiac Ghoul Trooper")

    if "!normalghoul" in args[0].lower():
        variants = client.user.party.me.create_variants(material=0)

        await client.user.party.me.set_outfit(
            asset='CID_029_Athena_Commando_F_Halloween', variants=variants)

        await message.reply('Skin set to Brainiac Ghoul Trooper!')
        time = datetime.datetime.now().strftime('%H:%M:%S')
        print(f" [PYBOT] [{time}] Client's Skin set to Normal Ghoul Trooper")

    if "!purpleportal" in args[0].lower():
        variants = client.user.party.me.create_variants(
            item='AthenaBackpack', particle_config='Particle', particle=1)

        await client.user.party.me.set_backpack(asset='BID_105_GhostPortal',
                                                variants=variants)

        await message.reply('Backpack set to Purple Ghost Portal!')
        time = datetime.datetime.now().strftime('%H:%M:%S')
        print(
            f" [PYBOT] [{time}] Client's Backpack set to Purple Ghost Portal")

    if "!banner" in args[0].lower():
        if len(args) == 1:
            await message.reply(
                'You need to specify which banner, color & level you want to set the banner as.'
            )
        if len(args) == 2:
            await client.user.party.me.set_banner(icon=args[1],
                                                  color=data['banner_colour'],
                                                  season_level=data['level'])
        if len(args) == 3:
            await client.user.party.me.set_banner(icon=args[1],
                                                  color=args[2],
                                                  season_level=data['level'])
        if len(args) == 4:
            await client.user.party.me.set_banner(icon=args[1],
                                                  color=args[2],
                                                  season_level=args[3])

        await message.reply(f'Banner set to; {args[1]} {args[2]} {args[3]}')
        time = datetime.datetime.now().strftime('%H:%M:%S')
        print(
            f" [PYBOT] [{time}] Banner set to; {args[1]} {args[2]} {args[3]}")

    if "CID_" in args[0]:
        await client.user.party.me.set_outfit(asset=args[0])
        await message.reply(f'Skin set to {args[0]}')
        time = datetime.datetime.now().strftime('%H:%M:%S')
        await print(f' [PYBOT] [{time}] Skin set to ' + args[0])

    if "!variants" in args[0]:
        args3 = int(args[3])

        if 'CID' in args[1]:
            variants = client.user.party.me.create_variants(**{args[2]: args3})
            await client.user.party.me.set_outfit(asset=args[1],
                                                  variants=variants)
        elif 'BID' in args[1]:
            variants = client.user.party.me.create_variants(
                item='AthenaBackpack', **{args[2]: args3})
            await client.user.party.me.set_backpack(asset=args[1],
                                                    variants=variants)
        elif 'PICKAXE_ID' in args[1]:
            variants = client.user.party.me.create_variants(
                item='AthenaPickaxe', **{args[2]: args3})
            await client.user.party.me.set_pickaxe(asset=args[1],
                                                   variants=variants)

        await message.reply(
            f'Set variants of {args[1]} to {args[2]} {args[3]}.')
        time = datetime.datetime.now().strftime('%H:%M:%S')
        print(
            f' [PYBOT] [{time}] Set variants of {args[1]} to {args[2]} {args[3]}.'
        )

    if "!checkeredrenegade" in args[0].lower():
        variants = client.user.party.me.create_variants(material=2)

        await client.user.party.me.set_outfit(
            asset='CID_028_Athena_Commando_F', variants=variants)

        await message.reply('Skin set to Checkered Renegade!')
        time = datetime.datetime.now().strftime('%H:%M:%S')
        print(f" [PYBOT] [{time}] Client's Skin set to Checkered Renegade")

    if "EID_" in args[0]:
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(asset=args[0])
        await message.reply('Emote set to ' + args[0] + '!')

    if "!stop" in args[0].lower():
        await client.user.party.me.clear_emote()
        await message.reply('Stopped emoting.')

    if "BID_" in args[0]:
        await client.user.party.me.set_backpack(asset=args[0])

        await message.reply('Backbling set to ' + message.content + '!')

    if "help" in args[0].lower():
        await message.reply(
            'Commands: !cosmetics - Lists Cosmetic Commands  |  !party - Lists Party Commands | You can view a more detailed commands list in my discord server!'
        )

    if "!cosmetics" in args[0].lower():
        await message.reply(
            'Cosmetic Commands: !skin (skin name), !backpack (backpack name), !emote (emote name) | !stop-to stop the emote, !pickaxe (pickaxe name), !point (pickaxe name), !pet (pet name), !emoji (emoji name), !variants (CID) (style type) (integer), !purpleskull, !pinkghoul, !brainiacghoul, !purpleportal, !checkeredrenegade, !banner (icon) (colour) (level), CID_, BID_, PICKAXE_ID_, EID_'
        )

    if "!party" in args[0].lower():
        await message.reply(
            'Party Commands: !ready, !unready, !sitout, !sitin, !bp (tier), !level (level), !echo (message), !leave, !kick (username), Playlist_'
        )

    if "Pickaxe_" in args[0]:
        await client.user.party.me.set_pickaxe(asset=args[0])

        await message.reply('Pickaxe set to ' + args[0] + '!')

    if "PetCarrier_" in args[0]:
        await client.user.party.me.set_backpack(
            asset="/Game/Athena/Items/Cosmetics/PetCarriers/" + args[0] + "." +
            args[0])

    if "Emoji_" in args[0]:
        await client.user.party.me.set_emote(asset='EID_ClearEmote')
        await client.user.party.me.set_emote(
            asset="/Game/Athena/Items/Cosmetics/Dances/Emoji/" + args[0] +
            "." + args[0])

    if "!ready" in args[0].lower():
        await client.user.party.me.set_ready(True)
        await message.reply('Ready!')

    if ("!unready" in args[0].lower()) or ("!sitin" in args[0].lower()):
        await client.user.party.me.set_ready(False)
        await message.reply('Unready!')

    if "!sitout" in args[0].lower():
        await client.user.party.me.set_ready(None)
        await message.reply('Sitting Out!')

    if "!bp" in args[0].lower():
        await client.user.party.me.set_battlepass_info(has_purchased=True,
                                                       level=args[1],
                                                       self_boost_xp='0',
                                                       friend_boost_xp='0')

    if "!level" in args[0].lower():
        await client.user.party.me.set_banner(
            icon=client.user.party.me.banner[0],
            color=client.user.party.me.banner[1],
            season_level=args[1])

    if "!reset" in args[0].lower():
        variants = client.user.party.me.create_variants(
            **{data['variants-type']: data['variants']})
        await client.user.party.me.set_outfit(asset=data['cid'],
                                              variants=variants)
        await client.user.party.me.set_backpack(asset=data['bid'])
        await client.user.party.me.set_banner(icon=data['banner'],
                                              color=data['banner_colour'],
                                              season_level=data['level'])
        await client.user.party.me.set_pickaxe(asset=data['pid'])
        await client.user.party.me.set_battlepass_info(has_purchased=True,
                                                       level=data['bp_tier'],
                                                       self_boost_xp='0',
                                                       friend_boost_xp='0')
        await message.reply(f"Reset to default cosmetic loadout.")

    if "!echo" in args[0].lower():
        if message.author.display_name in data['FullAccess']:
            await client.user.party.send(joinedArguments)
            time = datetime.datetime.now().strftime('%H:%M:%S')
            print(f' [PYBOT] [{time}] ' + color.GREEN + 'Sent Message:' +
                  color.END + f' {joinedArguments}')
        else:
            if message.author.display_name not in data['FullAccess']:
                await message.reply(f"You don't have access to this command!")

    if "!admin" in args[0].lower():
        if message.author.display_name in data['FullAccess']:
            if len(args) == 1:
                await message.reply(
                    'Please specify if you want to add or remove a user from the admin list'
                )
                time = datetime.datetime.now().strftime('%H:%M:%S')
                print(
                    f' [PYBOT] [{time}] Please specify if you want to add or remove a user from the admin list, using '
                    + color.GREEN + '!admin add ' + color.END + 'or ' +
                    color.GREEN + '!admin remove' + color.END)
            if len(args) == 2:
                if args[1].lower() == 'add' or args[1].lower() == 'remove':
                    await message.reply(
                        'Please specify the name of the user you want to add/remove from the admin list'
                    )
                    time = datetime.datetime.now().strftime('%H:%M:%S')
                    print(
                        f' [PYBOT] [{time}] Please specify the name of the user you want to add/remove from the admin list'
                    )
                else:
                    await message.reply(
                        'Invalid usage, try !admin add <username> or !admin remove <username>'
                    )
                    time = datetime.datetime.now().strftime('%H:%M:%S')
                    print(f' [PYBOT] [{time}] Invalid usage, try ' +
                          color.GREEN + '!admin add <username> ' + color.END +
                          'or ' + color.GREEN + '!admin remove <username>' +
                          color.END)
            if len(args) >= 3:
                joinedArgumentsAdmin = " ".join(args[2:])
                user = await client.fetch_profile(joinedArgumentsAdmin)
                try:
                    if args[1].lower() == 'add':
                        if user.display_name not in data['FullAccess']:
                            data['FullAccess'].append(f"{user.display_name}")
                            with open('config.json', 'w') as f:
                                json.dump(data, f, indent=4)
                                print(f" [PYBOT] [{time}] Added " +
                                      color.GREEN + f"{user.display_name}" +
                                      color.END + " as an admin")
                        elif user.display_name in data['FullAccess']:
                            time = datetime.datetime.now().strftime('%H:%M:%S')
                            print(f" [PYBOT] [{time}]" + color.GREEN +
                                  f" {user.display_name}" + color.END +
                                  " is already an admin")
                    elif args[1].lower() == 'remove':
                        if user.display_name in data['FullAccess']:
                            data['FullAccess'].remove(user.display_name)
                            with open('config.json', 'w') as f:
                                json.dump(data, f, indent=4)
                                print(f" [PYBOT] [{time}] Removed " +
                                      color.GREEN + f"{user.display_name}" +
                                      color.END + " as an admin")
                        elif user.display_name not in data['FullAccess']:
                            time = datetime.datetime.now().strftime('%H:%M:%S')
                            print(f" [PYBOT] [{time}]" + color.GREEN +
                                  f" {user.display_name}" + color.END +
                                  " is not an admin")
                except AttributeError:
                    pass
                    time = datetime.datetime.now().strftime('%H:%M:%S')
                    print(f" [PYBOT] [{time}] Can't find user: "******"{joinedArgumentsAdmin}" + color.END)
                    await message.reply(
                        f"I couldn't find an Epic account with the name: {joinedArgumentsAdmin}."
                    )
        if message.author.display_name not in data['FullAccess']:
            if len(args) >= 3 and args[1].lower() == 'add':
                await message.reply(f"Password?")
                res = await client.wait_for('friend_message')
                content = res.content.lower()
                joinedArgumentsAdmin = " ".join(args[2:])
                user = await client.fetch_profile(joinedArgumentsAdmin)
                if content in data['AdminPassword']:
                    if user.display_name not in data['FullAccess']:
                        data['FullAccess'].append(f"{user.display_name}")
                        with open('config.json', 'w') as f:
                            json.dump(data, f, indent=4)
                            await message.reply(
                                f"Correct. Added {user.display_name} as an admin."
                            )
                            print(f" [PYBOT] [{time}] Added " + color.GREEN +
                                  f"{user.display_name}" + color.END +
                                  " as an admin")
                    elif user.display_name in data['FullAccess']:
                        time = datetime.datetime.now().strftime('%H:%M:%S')
                        print(f" [PYBOT] [{time}]" + color.GREEN +
                              f" {user.display_name}" + color.END +
                              " is already an admin")
                        await message.reply(
                            f"{user.display_name} is already an admin.")
            else:
                await message.reply(f"You don't have access to this command!")

    if "!status" in args[0].lower():
        if message.author.display_name in data['FullAccess']:
            await client.set_status(joinedArguments)
            await message.reply(f'Status set to {joinedArguments}')
            time = datetime.datetime.now().strftime('%H:%M:%S')
            print(f' [PYBOT] [{time}] Status set to {joinedArguments}.')
        else:
            if message.author.display_name not in data['FullAccess']:
                await message.reply(f"You don't have access to this command!")

    if "!leave" in args[0].lower():
        if message.author.display_name in data['FullAccess']:
            await client.user.party.me.set_emote('EID_Snap')
            delay.sleep(2)
            await client.user.party.me.leave()
            await message.reply('Bye!')
            time = datetime.datetime.now().strftime('%H:%M:%S')
            print(Fore.GREEN +
                  f' [PYBOT] [{time}] Left the party as I was requested.')
        else:
            if message.author.display_name not in data['FullAccess']:
                await message.reply(f"You don't have access to this command!")

    if "!kick" in args[0].lower(
    ) and message.author.display_name in data['FullAccess']:
        user = await client.fetch_profile(joinedArguments)
        member = client.user.party.members.get(user.id)
        if member is None:
            await message.reply(
                "Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.kick()
                await message.reply(f"Kicked user: {member.display_name}.")
                time = datetime.datetime.now().strftime('%H:%M:%S')
                print(Fore.GREEN +
                      f" [PYBOT] [{time}] Kicked user: {member.display_name}")
            except Exception as e:
                pass
                await message.reply(
                    f"Couldn't kick {member.display_name}, as I'm not party leader."
                )
                time = datetime.datetime.now().strftime('%H:%M:%S')
                print(
                    Fore.RED +
                    f" [PYBOT] [{time}] [ERROR] Failed to kick member as I don't have the required permissions."
                    + Fore.WHITE)
        if message.author.display_name not in data['FullAccess']:
            await message.reply(f"You don't have access to this command!")

    if "!join" in args[0] and message.author.display_name in data['FullAccess']:
        if len(args) != 1:
            user = await client.fetch_profile(joinedArguments)
            friend = client.get_friend(user.id)
        if len(args) == 1:
            user = await client.fetch_profile(message.author.id,
                                              cache=False,
                                              raw=False)
            friend = client.get_friend(user.id)
        if friend is None:
            await message.reply(
                f"Unable to invite that user, are you sure the bot has them added?"
            )
            print(
                Fore.RED +
                f" [PYBOT] [{time}] [ERROR] Unable to invite user: {joinedArguments}, are you sure the bot has them added?"
                + Fore.WHITE)
        if message.author.display_name not in data['FullAccess']:
            await message.reply(f"You don't have access to this command!")
        else:
            try:
                await friend.join_party()
                await message.reply(f"Joining {friend.display_name}'s party.")
            except Exception as e:
                await message.reply(
                    f"Can not join {friend.display_name}'s party.")

    if "!invite" in args[0].lower():
        if len(args) != 1:
            user = await client.fetch_profile(joinedArguments)
            friend = client.get_friend(user.id)
        if len(args) == 1:
            user = await client.fetch_profile(message.author.id,
                                              cache=False,
                                              raw=False)
            friend = client.get_friend(user.id)
        if friend is None:
            await message.reply(
                f"Unable to invite that user, are you sure the bot has them added?"
            )
            print(
                Fore.RED +
                f" [PYBOT] [{time}] [ERROR] Unable to invite user: {joinedArguments}, are you sure the bot has them added?"
                + Fore.WHITE)
        else:
            try:
                await friend.invite()
                await message.reply(f"Invited user: {friend.display_name}.")
                time = datetime.datetime.now().strftime('%H:%M:%S')
                print(Fore.GREEN +
                      f" [PYBOT] [{time}] Invited user: {friend.display_name}")
            except Exception as e:
                pass
                await message.reply(
                    f"Something went wrong trying to invite {friend.display_name}"
                )
                time = datetime.datetime.now().strftime('%H:%M:%S')
                print(
                    Fore.RED +
                    f" [PYBOT] [{time}] [ERROR] Something went wrong while trying to invite {friend.display_name}"
                    + Fore.WHITE)

    if "!add" in args[0].lower(
    ) and message.author.display_name in data['FullAccess']:
        user = await client.fetch_profile(joinedArguments)
        friends = client.friends
        if user is None:
            await message.reply(
                f"I can't find a player with the name of {joinedArguments}.")
            time = datetime.datetime.now().strftime('%H:%M:%S')
            print(
                Fore.RED +
                f" [PYBOT] [{time}] [ERROR] Unable to find a player with the name {joinedArguments}"
            )
        else:
            try:
                if (user.id in friends):
                    await message.reply(
                        f"I already have {user.display_name} as a friend.")
                    time = datetime.datetime.now().strftime('%H:%M:%S')
                    print(
                        Fore.RED +
                        f" [PYBOT] [{time}] [ERROR] You already have {user.display_name} added as a friend."
                    )
                else:
                    await client.add_friend(user.id)
                    await message.reply(
                        f"Sent a friend request to {user.display_name}")
                    time = datetime.datetime.now().strftime('%H:%M:%S')
                    print(
                        Fore.GREEN +
                        f" [PYBOT] [{time}] {client.user.display_name} sent a friend request to {user.display_name}"
                        + Fore.WHITE)
            except Exception as e:
                pass
                time = datetime.datetime.now().strftime('%H:%M:%S')
                print(
                    Fore.RED +
                    f" [PYBOT] [{time}] [ERROR] Something went wrong adding {joinedArguments}"
                    + Fore.WHITE)
        if message.author.display_name not in data['FullAccess']:
            await message.reply(f"You don't have access to this command!")

    if "!remove" in args[0].lower(
    ) and message.author.display_name in data['FullAccess']:
        user = await client.fetch_profile(joinedArguments)
        friends = client.friends
        if user is None:
            await message.reply(
                f"I can't find a player with the name of {joinedArguments}.")
            time = datetime.datetime.now().strftime('%H:%M:%S')
            print(
                Fore.RED +
                f" [PYBOT] [{time}] [ERROR] Unable to find a player with the name {joinedArguments}"
            )
        else:
            try:
                if (user.id in friends):
                    await client.remove_friend(user.id)
                    await message.reply(
                        f"Sucessfully removed {user.display_name} as a friend."
                    )
                    time = datetime.datetime.now().strftime('%H:%M:%S')
                    print(
                        Fore.GREEN +
                        f" [PYBOT] [{time}] {client.user.display_name} removed {user.display_name} as a friend."
                    )
                else:
                    await client.add_friend(user.id)
                    await message.reply(
                        f"I don't have {user.display_name} as a friend.")
                    time = datetime.datetime.now().strftime('%H:%M:%S')
                    print(
                        Fore.RED +
                        f" [PYBOT] [{time}] [ERROR] {client.user.display_name} tried removing {user.display_name} as a friend, but the client doesn't have the friend added."
                        + Fore.WHITE)
            except Exception as e:
                pass
                time = datetime.datetime.now().strftime('%H:%M:%S')
                print(
                    Fore.RED +
                    f" [PYBOT] [{time}] [ERROR] Something went wrong removing {joinedArguments} as a friend."
                    + Fore.WHITE)
        if message.author.display_name not in data['FullAccess']:
            await message.reply(f"You don't have access to this command!")

    if "!showfriends" in args[0].lower(
    ) and message.author.display_name in data['FullAccess']:
        friends = client.friends
        onlineFriends = []
        offlineFriends = []
        for f in friends:
            friend = client.get_friend(f)
            if friend.is_online:
                onlineFriends.append(friend.display_name)
            else:
                offlineFriends.append(friend.display_name)
        time = datetime.datetime.now().strftime('%H:%M:%S')
        print(f" [PYBOT] [{time}] " + Fore.WHITE + "Friends List: " +
              Fore.GREEN + f"{len(onlineFriends)} Online " + Fore.WHITE + "/" +
              Fore.LIGHTBLACK_EX + f" {len(offlineFriends)} Offline " +
              Fore.WHITE + "/" + Fore.LIGHTWHITE_EX +
              f" {len(onlineFriends) + len(offlineFriends)} Total")
        for x in onlineFriends:
            if x is not None:
                print(Fore.GREEN + " " + x + Fore.WHITE)
        for x in offlineFriends:
            if x is not None:
                print(Fore.LIGHTBLACK_EX + " " + x + Fore.WHITE)
        await message.reply(
            "Check the command window for the list of my friends.")
        if message.author.display_name not in data['FullAccess']:
            await message.reply(f"You don't have access to this command!")

    if "!promote" in args[0].lower(
    ) and message.author.display_name in data['FullAccess']:
        if len(args) != 1:
            user = await client.fetch_profile(joinedArguments)
            member = client.user.party.members.get(user.id)
        if len(args) == 1:
            user = await client.fetch_profile(message.author.display_name)
            member = client.user.party.members.get(user.id)
        if member is None:
            await message.reply(
                "Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.promote()
                await message.reply(f"Promoted user: {member.display_name}.")
                time = datetime.datetime.now().strftime('%H:%M:%S')
                print(
                    Fore.GREEN +
                    f" [PYBOT] [{time}] Promoted user: {member.display_name}")
            except Exception as e:
                pass
                await message.reply(
                    f"Couldn't promote {member.display_name}, as I'm not party leader."
                )
                time = datetime.datetime.now().strftime('%H:%M:%S')
                print(
                    Fore.RED +
                    f" [PYBOT] [{time}] [ERROR] Failed to promote member as I don't have the required permissions."
                    + Fore.WHITE)
        if message.author.display_name not in data['FullAccess']:
            await message.reply(f"You don't have access to this command!")

    if "Playlist_" in args[0]:
        try:
            await client.user.party.set_playlist(playlist=args[0])
        except Exception as e:
            pass
            await message.reply(
                f"Couldn't set gamemode to {args[0]}, as I'm not party leader."
            )
            time = datetime.datetime.now().strftime('%H:%M:%S')
            print(
                Fore.RED +
                f" [PYBOT] [{time}] [ERROR] Failed to set gamemode as I don't have the required permissions."
                + Fore.WHITE)

    if "!platform" in args[0] and message.author.display_name in data[
            'FullAccess']:
        await message.reply('Setting platform to ' + args[1] + '.')
        party_id = client.user.party.id
        await client.user.party.me.leave()
        client.platform = fortnitepy.Platform(args[1])
        await message.reply('Platform set to ' + str(client.platform) + '.')
        try:
            await client.join_to_party(party_id, check_private=True)
        except Exception as e:
            pass
            await message.reply(
                'Failed to join back as party is set to private.')
        else:
            if message.author.display_name not in data['FullAccess']:
                await message.reply(f"You don't have access to this command!")

    if args[0] == "!id":
        user = await client.fetch_profile(joinedArguments,
                                          cache=False,
                                          raw=False)
        try:
            await message.reply(f"{joinedArguments}'s Epic ID is: {user.id}")
            time = datetime.datetime.now().strftime('%H:%M:%S')
            print(
                Fore.GREEN +
                f" [PYBOT] [{time}] {joinedArguments}'s Epic ID is: {user.id}")
        except AttributeError:
            await message.reply(
                f"I couldn't find an Epic account with the name: {joinedArguments}."
            )
            time = datetime.datetime.now().strftime('%H:%M:%S')
            print(
                Fore.RED +
                f" [PYBOT] [{time}] [ERROR] I couldn't find an Epic account with the name: {joinedArguments}."
            )
Exemplo n.º 15
0
async def event_friend_message(message):
    args = message.content.split()
    split = args[1:]
    content = " ".join(split)
    print(
        f'[FORTNITEPY] [{getTime()}] {message.author.display_name}: {message.content}'
    )

    if "!skin" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(content,
                                                  parameter='displayName',
                                                  sorter='type',
                                                  filter='Outfit')
        if cosmetic == None:
            await message.reply(
                f"Couldn't find a skin with the name: {content}")
        else:
            await client.user.party.me.set_outfit(asset=cosmetic.id)
            await message.reply(f'Skin set to {cosmetic.id}')
            print(f"[FORTNITEPY] [{getTime()}] Set Skin to: {cosmetic.id}")

    elif "!backpack" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(content,
                                                  parameter='displayName',
                                                  sorter='type',
                                                  filter='Back Bling')
        if cosmetic == None:
            await message.reply(
                f"Couldn't find a backpack with the name: {content}")
        else:
            await client.user.party.me.set_backpack(asset=cosmetic.id)
            await message.reply(f'Backpack set to {cosmetic.id}')
            print(f"[FORTNITEPY] [{getTime()}] Set Backpack to: {cosmetic.id}")

    elif "!emote" in args[0].lower():
        await client.user.party.me.clear_emote()
        cosmetic = await BenBotAsync.get_cosmetic(content,
                                                  parameter='displayName',
                                                  sorter='type',
                                                  filter='Emote')
        if cosmetic == None:
            await message.reply(
                f"Couldn't find a skin with the name: {content}")
        else:
            await client.user.party.me.set_emote(asset=cosmetic.id)
            await message.reply(f'Emote set to {cosmetic.id}')
            print(f"[FORTNITEPY] [{getTime()}] Set Emote to: {cosmetic.id}")

    elif "!pickaxe" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(content,
                                                  parameter='displayName',
                                                  sorter='type',
                                                  filter='Harvesting Tool')
        if cosmetic == None:
            await message.reply(
                f"Couldn't find a pickaxe with the name: {content}")
        else:
            await client.user.party.me.set_pickaxe(asset=cosmetic.id)
            await message.reply(f'Pickaxe set to {cosmetic.id}')
            print(f"[FORTNITEPY] [{getTime()}] Set Pickaxe to: {cosmetic.id}")

    elif "!pet" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(content,
                                                  parameter='displayName',
                                                  sorter='backendType',
                                                  filter='AthenaPet')
        await client.user.party.me.set_backpack(
            asset=
            f"/Game/Athena/Items/Cosmetics/PetCarriers/{cosmetic.id}.{cosmetic.id}"
        )
        await message.reply(f'Pet set to {cosmetic.id}')
        print(f"[FORTNITEPY] [{getTime()}] Set PetCarrier to: {cosmetic.id}")

    elif "!emoji" in args[0].lower():
        cosmetic = await BenBotAsync.get_cosmetic(content,
                                                  parameter='displayName',
                                                  sorter='backendType',
                                                  filter='AthenaDance')
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(
            asset=
            f"/Game/Athena/Items/Cosmetics/Dances/Emoji/{cosmetic.id}.{cosmetic.id}"
        )
        await message.reply(f'Emoji set to {cosmetic.id}')
        print(f"[FORTNITEPY] [{getTime()}] Set Emoji to: {cosmetic.id}")

    elif "!purpleskull" in args[0].lower():
        variants = client.user.party.me.create_variants(clothing_color=1)

        await client.user.party.me.set_outfit(
            asset='CID_030_Athena_Commando_M_Halloween', variants=variants)

        await message.reply('Skin set to Purple Skull Trooper!')

    elif "!pinkghoul" in args[0].lower():
        variants = client.user.party.me.create_variants(material=3)

        await client.user.party.me.set_outfit(
            asset='CID_029_Athena_Commando_F_Halloween', variants=variants)

        await message.reply('Skin set to Pink Ghoul Trooper!')

    elif "!purpleportal" in args[0].lower():
        variants = client.user.party.me.create_variants(
            item='AthenaBackpack', particle_config='Particle', particle=1)

        await client.user.party.me.set_backpack(asset='BID_105_GhostPortal',
                                                variants=variants)

        await message.reply('Backpack set to Purple Ghost Portal!')

    elif "!banner" in args[0].lower():
        if len(args) == 1:
            await message.reply(
                'You need to specifiy which banner, color & level you want to set the banner as.'
            )
        if len(args) == 2:
            await client.user.party.me.set_banner(icon=args[1],
                                                  color=data['banner_colour'],
                                                  season_level=data['level'])
        if len(args) == 3:
            await client.user.party.me.set_banner(icon=args[1],
                                                  color=args[2],
                                                  season_level=data['level'])
        if len(args) == 4:
            await client.user.party.me.set_banner(icon=args[1],
                                                  color=args[2],
                                                  season_level=args[3])

        await message.reply(f'Banner set to; {args[1]} {args[2]} {args[3]}')
        print(
            f"[FORTNITEPY] [{getTime()}] Banner set to; {args[1]} {args[2]} {args[3]}"
        )

    elif "cid_" in args[0].lower():
        await client.user.party.me.set_outfit(asset=args[0])

        await message.reply(f'Skin set to {args[0]}')
        await print(f'[FORTNITEPY] [{getTime()}] Skin set to {args[0]}')

    elif "vtid_" in args[0].lower():
        VTID = await setVTID(args[0])
        if VTID[1] == 'Particle':
            variants = client.user.party.me.create_variants(
                particle_config='Particle', particle=1)
        else:
            variants = client.user.party.me.create_variants(
                **{VTID[1].lower(): int(VTID[2])})

        await client.user.party.me.set_outfit(asset=VTID[0], variants=variants)
        await message.reply(
            f'Variants set to {args[0]}.\n(Warning: This feature is not supported, please use !variants)'
        )

    elif "!variants" in args[0]:
        try:
            args3 = int(args[3])
        except ValueError:
            args3 = args[3]

        if 'cid' in args[1].lower() and 'jersey_color' not in args[2]:
            variants = client.user.party.me.create_variants(
                **{args[2]: args[3]})
            await client.user.party.me.set_outfit(asset=args[1],
                                                  variants=variants)
        elif 'cid' in args[1].lower() and 'jersey_color' in args[2]:
            variants = client.user.party.me.create_variants(
                pattern=0, numeric=69, **{args[2]: args[3]})
            await client.user.party.me.set_outfit(asset=args[1],
                                                  variants=variants)
        elif 'bid' in args[1].lower():
            variants = client.user.party.me.create_variants(
                item='AthenaBackpack', **{args[2]: args3})
            await client.user.party.me.set_backpack(asset=args[1],
                                                    variants=variants)
        elif 'pickaxe_id' in args[1].lower():
            variants = client.user.party.me.create_variants(
                item='AthenaPickaxe', **{args[2]: args3})
            await client.user.party.me.set_pickaxe(asset=args[1],
                                                   variants=variants)

        await message.reply(
            f'Set variants of {args[1]} to {args[2]} {args[3]}.')
        print(
            f'[FORTNITEPY] [{getTime()}] Set variants of {args[1]} to {args[2]} {args[3]}.'
        )

    elif "!soccerskin" in args[0].lower():
        me = client.user.party.me

        variants = me.create_variants(jersey_color='Norway')

        await me.set_outfit(asset='CID_149_Athena_Commando_F_SoccerGirlB',
                            variants=variants)

    elif "!soccerskin2" in args[0].lower():
        me = client.user.party.me

        variants = me.create_variants(**{"jersey_color": "Norway"})

        await me.set_outfit(asset='CID_149_Athena_Commando_F_SoccerGirlB',
                            variants=variants)

    elif "!checkeredrenegade" in args[0].lower():
        variants = client.user.party.me.create_variants(material=2)

        await client.user.party.me.set_outfit(
            asset='CID_028_Athena_Commando_F', variants=variants)

        await message.reply('Skin set to Checkered Renegade!')

    elif "!mintyelf" in args[0].lower():
        variants = client.user.party.me.create_variants(material=2)

        await client.user.party.me.set_outfit(
            asset='CID_051_Athena_Commando_M_HolidayElf', variants=variants)

        await message.reply('Skin set to Minty Elf!')

    elif "eid_" in args[0].lower():
        await client.user.party.me.clear_emote()
        await client.user.party.me.set_emote(asset=args[0])
        await message.reply(f'Emote set to {args[0]}!')

    elif "!stop" in args[0].lower():
        await client.user.party.me.clear_emote()
        await message.reply('Stopped emoting.')

    elif "bid_" in args[0].lower():
        await client.user.party.me.set_backpack(asset=args[0])

        await message.reply(f'Backbling set to {args[0]}!')

    elif "!help" in args[0].lower():
        await message.reply(
            'For a list of commands, goto; https://github.com/xMistt/fortnitepy-bot'
        )

    elif "PICKAXE_ID_" in args[0].lower():
        await client.user.party.me.set_pickaxe(asset=args[0])

        await message.reply(f'Pickaxe set to {args[0]}')

    elif "petcarrier_" in args[0].lower():
        await client.user.party.me.set_backpack(
            asset=f"/Game/Athena/Items/Cosmetics/PetCarriers/{args[0]}.{args[0]}"
        )

    elif "emoji_" in args[0].lower():
        await client.user.party.me.set_emote(asset='EID_ClearEmote')
        await client.user.party.me.set_emote(
            asset=
            f"/Game/Athena/Items/Cosmetics/Dances/Emoji/{args[0]}.{args[0]}")

    elif "!legacypickaxe" in args[0].lower():
        await client.user.party.me.set_pickaxe(asset=args[1])

        await message.reply(f'Pickaxe set to {args[1]}!')

    elif "!point" in args[0].lower():
        if 'PICKAXE_ID' in args[1]:
            await client.user.party.me.set_pickaxe(asset=args[1])
            await client.user.party.me.set_emote(asset='EID_IceKing')
            await message.reply(
                f'Pickaxe set to {args[1]} & Point it Out played.')
        else:
            cosmetic = await BenBotAsync.get_cosmetic(content,
                                                      parameter='displayName',
                                                      sorter='type',
                                                      filter='Harvesting Tool')
            if cosmetic == None:
                await message.reply(
                    f"Couldn't find a pickaxe with the name: {content}")
            else:
                await client.user.party.me.set_pickaxe(asset=cosmetic.id)
                await client.user.party.me.set_emote(asset='EID_IceKing')
                await message.reply(
                    f'Pickaxe set to {content} & Point it Out played.')

    elif "!ready" in args[0].lower():
        await client.user.party.me.set_ready(True)
        await message.reply('Ready!')

    elif ("!unready" in args[0].lower()) or ("!sitin" in args[0].lower()):
        await client.user.party.me.set_ready(False)
        await message.reply('Unready!')

    elif "!sitout" in args[0].lower():
        await client.user.party.me.set_ready(None)
        await message.reply('Sitting Out!')

    elif "!bp" in args[0].lower():
        await client.user.party.me.set_battlepass_info(has_purchased=True,
                                                       level=args[1],
                                                       self_boost_xp='0',
                                                       friend_boost_xp='0')

    elif "!level" in args[0].lower():
        await client.user.party.me.set_banner(
            icon=client.user.party.me.banner[0],
            color=client.user.party.me.banner[1],
            season_level=args[1])

    elif "!echo" in args[0].lower():
        await client.user.party.send(content)

    elif "!status" in args[0].lower():
        await client.set_status(content)

        await message.reply(f'Status set to {content}')
        print(f'[FORTNITEPY] [{getTime()}] Status set to {content}.')

    elif "!leave" in args[0].lower():
        await client.user.party.me.set_emote('EID_Wave')
        await asyncio.sleep(2)
        await client.user.party.me.leave()
        await message.reply('Bye!')
        print(f'[FORTNITEPY] [{getTime()}] Left the party as I was requested.')

    elif "!kick" in args[0].lower():
        user = await client.fetch_profile(content)
        member = client.user.party.members.get(user.id)
        if member is None:
            await message.reply(
                "Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.kick()
                await message.reply(f"Kicked user: {member.display_name}.")
                print(
                    f"[FORTNITEPY] [{getTime()}] Kicked user: {member.display_name}"
                )
            except fortnitepy.PartyPermissionError:
                await message.reply(
                    f"Couldn't kick {member.display_name}, as I'm not party leader."
                )
                print(
                    crayons.red(
                        f"[FORTNITEPY] [{getTime()}] [ERROR] Failed to kick member as I don't have the required permissions."
                    ))

    elif "!promote" in args[0].lower():
        if len(args) != 1:
            user = await client.fetch_profile(content)
            member = client.user.party.members.get(user.id)
        if len(args) == 1:
            user = await client.fetch_profile(message.author.display_name)
            user = await client.user.party.members.get(user.id)

        if member is None:
            await message.reply(
                "Couldn't find that user, are you sure they're in the party?")
        else:
            try:
                await member.promote()
                await message.reply(f"Promoted user: {member.display_name}.")
                print(
                    f"[FORTNITEPY] [{getTime()}] Promoted user: {member.display_name}"
                )
            except fortnitepy.PartyPermissionError:
                await message.reply(
                    f"Couldn't promote {member.display_name}, as I'm not party leader."
                )
                print(
                    crayons.red(
                        f"[FORTNITEPY] [{getTime()}] [ERROR] Failed to promote member as I don't have the required permissions."
                    ))

    elif "Playlist_" in args[0]:
        try:
            await client.user.party.set_playlist(playlist=args[0])
        except fortnitepy.PartyPermissionError:
            await message.reply(
                f"Couldn't set gamemode to {args[1]}, as I'm not party leader."
            )
            print(
                crayons.red(
                    f"[FORTNITEPY] [{getTime()}] [ERROR] Failed to set gamemode as I don't have the required permissions."
                ))

    elif "!platform" in args[0]:
        await message.reply(f'Setting platform to {args[0]}')
        party_id = client.user.party.id
        await client.user.party.me.leave()
        client.platform = fortnitepy.Platform(args[1])
        await message.reply(f'Platform set to {str(client.platform)}.')
        try:
            await client.join_to_party(party_id, check_private=True)
        except fortnitepy.Forbidden:
            await message.reply(
                'Failed to join back as party is set to private.')

    elif args[0] == "!id":
        user = await client.fetch_profile(content, cache=False, raw=False)
        try:
            await message.reply(f"{content}'s Epic ID is: {user.id}")
        except AttributeError:
            await message.reply(
                f"I couldn't find an Epic account with the name: {content}.")