How to use fortnitepy - 10 common examples

To help you get started, we’ve selected a few fortnitepy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xMistt / fortnitepy-bot / fortnite.py View on Github external
"Example: !goldentntina"
)
async def goldentntina(ctx: fortnitepy.ext.commands.Context) -> None:
    await client.party.me.set_outfit(
        asset='CID_691_Athena_Commando_F_TNTina',
        variants=client.party.me.create_variants(progressive=7),
        enlightenment=(2, 260)
    )

    await ctx.send(f'Skin set to Golden TNTina.')


if (data['email'] and data['password']) and (data['email'] != 'email@email.com' and data['password'] != 'password1'):
    try:
        client.run()
    except fortnitepy.errors.AuthException as e:
        print(crayons.red(f"[PartyBot] [{time()}] [ERROR] {e}"))
else:
    print(crayons.red(f"[PartyBot] [{time()}] [ERROR] Failed to login as no (or default) account details provided."))
github xMistt / fortnitepy-bot / fortnite.py View on Github external
async def copy(ctx: fortnitepy.ext.commands.Context, *, epic_username: Union[str, None] = None) -> None:
    if epic_username is None:
        member = client.party.members.get(ctx.author.id)
    else:
        user = await client.fetch_profile(epic_username)
        member = client.party.members.get(user.id)

    await client.party.me.edit(
        functools.partial(
            fortnitepy.ClientPartyMember.set_outfit,
            asset=member.outfit,
            variants=member.outfit_variants
        ),
        functools.partial(
            fortnitepy.ClientPartyMember.set_backpack,
            asset=member.backpack,
            variants=member.backpack_variants
        ),
        functools.partial(
            fortnitepy.ClientPartyMember.set_pickaxe,
            asset=member.pickaxe,
            variants=member.pickaxe_variants
        ),
        functools.partial(
            fortnitepy.ClientPartyMember.set_banner,
            icon=member.banner[0],
github xMistt / fortnitepy-bot / fortnite.py View on Github external
user = await client.fetch_profile(epic_username)
        member = client.party.members.get(user.id)

    await client.party.me.edit(
        functools.partial(
            fortnitepy.ClientPartyMember.set_outfit,
            asset=member.outfit,
            variants=member.outfit_variants
        ),
        functools.partial(
            fortnitepy.ClientPartyMember.set_backpack,
            asset=member.backpack,
            variants=member.backpack_variants
        ),
        functools.partial(
            fortnitepy.ClientPartyMember.set_pickaxe,
            asset=member.pickaxe,
            variants=member.pickaxe_variants
        ),
        functools.partial(
            fortnitepy.ClientPartyMember.set_banner,
            icon=member.banner[0],
            color=member.banner[1],
            season_level=member.banner[2]
        ),
        functools.partial(
            fortnitepy.ClientPartyMember.set_battlepass_info,
            has_purchased=True,
            level=member.battlepass_info[1]
        )
    )
github Terbau / fortnitepy / examples / api_integrations / ben_bot.py View on Github external
def __init__(self):
        device_auth_details = 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
            )
        )
        self.session_event = asyncio.Event(loop=self.loop)
github Terbau / fortnitepy / examples / web / sanic_integration.py View on Github external
with open(filename, 'r') as fp:
            return json.load(fp)
    return {}

def store_device_auth_details(email, details):
    existing = get_device_auth_details()
    existing[email] = details

    with open(filename, 'w') as fp:
        json.dump(existing, fp)


device_auth_details = get_device_auth_details().get(email, {})
bot = commands.Bot(
    command_prefix='!',
    auth=fortnitepy.AdvancedAuth(
        email=email,
        password=password,
        prompt_authorization_code=True,
        delete_existing_device_auths=True,
        **device_auth_details
    )
)

sanic_app = sanic.Sanic(__name__)
server = None


@bot.event
async def event_device_auth_generate(details, email):
    store_device_auth_details(email, details)
github Terbau / fortnitepy / examples / discord_integration.py View on Github external
return {}


def store_device_auth_details(email, details):
    existing = get_device_auth_details()
    existing[email] = details

    with open(filename, 'w') as fp:
        json.dump(existing, fp)


device_auth_details = get_device_auth_details().get(email, {})
fortnite_bot = fortnite_commands.Bot(
    command_prefix='!',
    description=description,
    auth=fortnitepy.AdvancedAuth(
        email=email,
        password=password,
        prompt_authorization_code=True,
        delete_existing_device_auths=True,
        **device_auth_details
    )
)

discord_bot = discord_commands.Bot(
    command_prefix='!',
    description=description,
    case_insensitive=True
)


@fortnite_bot.event
github Terbau / fortnitepy / examples / multiple_sub_clients.py View on Github external
def __init__(self):
        device_auths = get_device_auth_details()
        super().__init__(
            auth=fortnitepy.AdvancedAuth(
                email=email,
                password=password,
                authorization=True,
                delete_existing_device_auths=True,
                **device_auths.get(email, {})
            )
        )
        self.instances = {}
github Terbau / fortnitepy / examples / basic_bot.py View on Github external
with open(filename, 'r') as fp:
            return json.load(fp)
    return {}

def store_device_auth_details(email, details):
    existing = get_device_auth_details()
    existing[email] = details

    with open(filename, 'w') as fp:
        json.dump(existing, fp)


device_auth_details = get_device_auth_details().get(email, {})
bot = commands.Bot(
    command_prefix='!',
    auth=fortnitepy.AdvancedAuth(
        email=email,
        password=password,
        prompt_authorization_code=True,
        delete_existing_device_auths=True,
        **device_auth_details
    )
)

@bot.event
async def event_device_auth_generate(details, email):
    store_device_auth_details(email, details)

@bot.event
async def event_ready():
    print('----------------')
    print('Bot ready as')
github xMistt / fortnitepy-bot / fortnite.py View on Github external
logger = logging.getLogger('fortnitepy.http')
    logger.setLevel(level=logging.DEBUG)
    handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(logging.Formatter('\u001b[36m %(asctime)s:%(levelname)s:%(name)s: %(message)s \u001b[0m'))
    logger.addHandler(handler)

    logger = logging.getLogger('fortnitepy.xmpp')
    logger.setLevel(level=logging.DEBUG)
    handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(logging.Formatter('\u001b[35m %(asctime)s:%(levelname)s:%(name)s: %(message)s \u001b[0m'))
    logger.addHandler(handler)

device_auth_details = get_device_auth_details().get(data['email'], {})
client = commands.Bot(
    command_prefix='!',
    auth=fortnitepy.AdvancedAuth(
        email=data['email'],
        password=data['password'],
        prompt_authorization_code=True,
        delete_existing_device_auths=True,
        **device_auth_details
    ),
    status=data['status'],
    platform=fortnitepy.Platform(data['platform']),
    avatar=fortnitepy.Avatar(
        asset="cid_028_ff2b06cf446376144ba408d3482f5c982bf2584cf0f508ee3e4ba4a0fd461a38",
        background_colors=fortnitepy.KairosBackgroundColorPreset.PINK.value
    )
)


@client.event
github Terbau / fortnitepy / examples / api_integrations / fortnite_api.py View on Github external
def __init__(self):
        device_auth_details = 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
            )
        )
        self.session_event = asyncio.Event()