示例#1
0
async def main() -> None:
    settings = partybot.BotSettings()

    await settings.load_settings_from_file('config.json')

    if settings.debug:
        enable_debug()

    async with aiohttp.ClientSession() as session:
        async with session.request(
                method="GET", url="https://partybot.net/api/discord") as r:
            invite = (await
                      r.json())['invite'] if r.status == 200 else "8heARRB"

    print(
        crayons.cyan(
            f"[PartyBot] [{datetime.datetime.now().strftime('%H:%M:%S')}] PartyBot made by xMistt. "
            'Massive credit to Terbau for creating the library.'))
    print(
        crayons.cyan(
            f"[PartyBot] [{datetime.datetime.now().strftime('%H:%M:%S')}] Discord server: "
            f"https://discord.gg/{invite} - For support, questions, etc."))

    device_auths = partybot.DeviceAuths(filename='device_auths.json')

    try:
        await device_auths.load_device_auths()
    except partybot.errors.MissingDeviceAuth:
        print(
            f"[PartyBot] [{datetime.datetime.now().strftime('%H:%M:%S')}] Automatically opening Epic Games login, "
            f"please sign in.")

        gen = partybot.EpicGenerator()
        new_device_auths = await gen.generate_device_auths()
        device_auths.set_device_auth(**new_device_auths)

        await device_auths.save_device_auths()

    client = partybot.PartyBot(settings=settings, device_auths=device_auths)

    client.add_cog(partybot.CosmeticCommands(client))
    client.add_cog(partybot.PartyCommands(client))
    client.add_cog(partybot.ClientCommands(client))

    try:
        await client.start()
    except fortnitepy.errors.AuthException as e:
        print(crayons.red(client.message % f"[ERROR] {e}"))

    await client.http.close()
示例#2
0
async def main() -> None:
    settings = partybot.BotSettings()
    device_auths = partybot.DeviceAuths(filename='device_auths.json')

    await settings.load_settings_from_file('config.json')
    await device_auths.load_device_auths()

    if settings.debug:
        enable_debug()

    client = partybot.PartyBot(settings=settings, device_auths=device_auths)

    client.add_cog(partybot.CosmeticCommands(client))
    client.add_cog(partybot.PartyCommands(client))
    client.add_cog(partybot.ClientCommands(client))

    async with aiohttp.ClientSession() as session:
        async with session.request(
                method="GET", url="https://partybot.net/api/discord") as r:
            invite = (await
                      r.json())['invite'] if r.status == 200 else "8heARRB"

    print(
        crayons.cyan(client.message % 'PartyBot made by xMistt. '
                     'Massive credit to Terbau for creating the library.'))
    print(
        crayons.cyan(
            client.message %
            f'Discord server: https://discord.gg/{invite} - For support, questions, etc.'
        ))

    if (settings.email and settings.password) and \
            (settings.email != '*****@*****.**' and settings.password != 'password1'):
        try:
            await client.start()
        except fortnitepy.errors.AuthException as e:
            print(crayons.red(client.message % f"[ERROR] {e}"))
    else:
        print(
            crayons.red(client.message %
                        f"[ERROR] Failed to login as no (or default) "
                        "account details provided."))

    await client.http.close()
示例#3
0
async def main() -> None:
    settings = partybot.BotSettings()
    device_auths = partybot.DeviceAuths(
        filename='device_auths.json'
    )

    await settings.load_settings_from_file('config.json')
    await device_auths.load_device_auths()

    if settings.debug:
        enable_debug()

    client = partybot.PartyBot(
        settings=settings,
        device_auths=device_auths
    )

    client.add_cog(partybot.CosmeticCommands(client))
    client.add_cog(partybot.PartyCommands(client))
    client.add_cog(partybot.ClientCommands(client))

    async with aiohttp.ClientSession() as session:
        async with session.request(
            method="GET",
            url="Add MariusInfo for information"
        ) as r:
            invite = (await r.json())['invite'] if r.status == 200 else "8heARRB"

    print(crayons.cyan(client.message % 'PartyBot made by MarisInfo
                       . '
                       'Use Code MariusInfo.'))

    if (settings.email and settings.password) and \
            (settings.email != '*****@*****.**' and settings.password != 'password1'):
        try:
            await client.start()
        except fortnitepy.errors.AuthException as e:
            print(crayons.red(client.message % f"[ERROR] {e}"))
    else:
        print(crayons.red(client.message % f"[ERROR] Failed to login as no (or default) "
                          "account details provided."))

    await client.http.close()