示例#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'
示例#2
0
    def __init__(self, name: str, details: dict):
        self.name = name
        self.task = None

        super().__init__(platform=fortnitepy.Platform.MAC,
                         connector=TCPConnector(limit=None),
                         auth=fortnitepy.AdvancedAuth(**details))
示例#3
0
 def __init__(self, details: dict):
     super().__init__(platform=fortnitepy.Platform.XBOX,
                      connector=TCPConnector(limit=None),
                      auth=fortnitepy.AdvancedAuth(**details),
                      default_party_config=fortnitepy.DefaultPartyConfig(
                          privacy=fortnitepy.PartyPrivacy.PUBLIC,
                          team_change_allowed=False,
                          chat_enabled=False))
示例#4
0
 def __init__(self):
     device_auth_details = get_device_auth_details().get(email, {})
     super().__init__(
         auth=fortnitepy.AdvancedAuth(email=email,
                                      password=password,
                                      prompt_exchange_code=True,
                                      delete_existing_device_auths=True,
                                      **device_auth_details))
 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 = {}
示例#6
0
    def __init__(self):
        super().__init__(auth=fortnitepy.AdvancedAuth(
            device_id=getenv("DEVICE_ID"),
            account_id=getenv("ACCOUNT_ID"),
            secret=getenv("SECRET"),
        ))

        self.loop = asyncio.get_event_loop()
        self.loop.create_task(self.start())
示例#7
0
文件: ben_bot.py 项目: zw5/fortnitepy
 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()
示例#8
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"]))
示例#9
0
 def __init__(self):
     device_auth_details = get_device_auth_details().get(email, {})
     super().__init__(command_prefix='!',
                      description=description,
                      auth=fortnitepy.AdvancedAuth(
                          email=email,
                          password=password,
                          prompt_authorization_code=True,
                          delete_existing_device_auths=True,
                          **device_auth_details))
示例#10
0
 def __init__(self, data):
     self.data = data
     device_auth_details = self.get_device_auth_details().get(
         self.data["email"], {})
     super().__init__(
         auth=fortnitepy.AdvancedAuth(email=self.data["email"],
                                      password=self.data["password"],
                                      prompt_authorization_code=True,
                                      delete_existing_device_auths=True,
                                      **device_auth_details))
示例#11
0
文件: main_script.py 项目: zw5/boat
 def start(self):
     self.client = fortnitepy.Client(
         auth=fortnitepy.AdvancedAuth(
             email=self.email,
             exchange_code=self.get_code,
             device_id=self.device_id,
             account_id=self.client_id,
             secret=self.secret
         )
     )
     self.client.add_event_handler("friend_message", self.test_commands)
     self.client.add_event_handler("party_message", self.test_commands)
     self.client.add_event_handler("ready", self.on_ready)
     self.client.add_event_handler("party_invite", self.on_invite)
示例#12
0
async def get_device_auth(email, password, code):
    device_auth_details = get_device_auth_details().get(email.lower(), {})
    auth = fortnitepy.AdvancedAuth(email=email,
                                   password=password,
                                   authorization_code=code,
                                   delete_existing_device_auths=True,
                                   **device_auth_details)
    client = fortnitepy.Client(auth=auth)
    client.add_event_handler('event_device_auth_generate',
                             event_device_auth_generate)
    client.add_event_handler('event_ready', event_ready)
    global current_client
    current_client = client
    await client.start()
示例#13
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'
示例#14
0
    async def event_ready(self):
        print('Main client ready. Launching sub-accounts...')

        clients = []
        device_auths = get_device_auth_details()
        for email, password in credentials.items():
            client = fortnitepy.Client(
                auth=fortnitepy.AdvancedAuth(email=email,
                                             password=password,
                                             prompt_authorization_code=True,
                                             prompt_code_if_invalid=True,
                                             delete_existing_device_auths=True,
                                             **device_auths.get(email, {})),
                default_party_member_config=fortnitepy.
                DefaultPartyMemberConfig(meta=(
                    functools.partial(
                        fortnitepy.ClientPartyMember.set_outfit,
                        'CID_175_Athena_Commando_M_Celestial'),  # galaxy skin
                )))

            # register events here
            client.add_event_handler('device_auth_generate',
                                     self.event_sub_device_auth_generate)
            client.add_event_handler('friend_request',
                                     self.event_sub_friend_request)
            client.add_event_handler('party_member_join',
                                     self.event_sub_party_member_join)

            clients.append(client)

        try:
            await fortnitepy.start_multiple(
                clients,
                ready_callback=self.event_sub_ready,
                all_ready_callback=lambda: print('All sub clients ready'))
        except fortnitepy.AuthException:
            print(
                'An error occured while starting sub clients. Closing gracefully.'
            )
            await self.close()
示例#15
0

def store_detalles_autentificacion(email, details):
    existing = get_detalles_autentificacion()
    existing[email] = details

    with open('auths.json', 'w') as fp:
        json.dump(existing, fp, sort_keys=False, indent=4)


device_auth_details = get_detalles_autentificacion().get(config["correo"], {})

client = fortnitepy.Client(
    auth=fortnitepy.AdvancedAuth(email=config["correo"],
                                 password=config["contraseña"],
                                 prompt_authorization_code=True,
                                 delete_existing_device_auths=False,
                                 **device_auth_details),
    status=config["estado"],
    platform=plataforma,
    avatar=fortnitepy.Avatar(asset=config["kairos_avatar_id"],
                             background_colors=config["kairos_avatar_fondo"]))


#Eventos y comandos
@client.event
async def event_device_auth_generate(details: dict, email: str) -> None:
    store_detalles_autentificacion(email, details)


@client.event
示例#16
0
    def __init__(self, config: dict):
        self.config = config

        super().__init__(platform=config.get("Platform", "WIN"),
                         connector=TCPConnector(limit=None),
                         auth=fortnitepy.AdvancedAuth())
示例#17
0
async def event_sub_friend_request(request):
    print('{0.client.user.display_name} received a friend request.'.format(request))
    await request.accept()

async def event_sub_party_member_join(member):
    print("{0.display_name} joined {0.client.user.display_name}'s party.".format(member))            


clients = []
device_auths = get_device_auth_details()
for email, password in credentials.items():
    authentication = fortnitepy.AdvancedAuth(
        email=email,
        password=password,
        prompt_authorization_code=True,
        prompt_code_if_invalid=True,
        delete_existing_device_auths=True,
        **device_auths.get(email, {})
    )

    client = fortnitepy.Client(
        auth=authentication,
        default_party_member_config=fortnitepy.DefaultPartyMemberConfig(
            meta=(
                functools.partial(fortnitepy.ClientPartyMember.set_outfit, 'CID_175_Athena_Commando_M_Celestial'), # galaxy skin
            )
        )
    )

    # register events here
    client.add_event_handler('device_auth_generate', event_sub_device_auth_generate)
示例#18
0
文件: main.py 项目: amesaa/GhoulFN
        return ctx.author.id in info["FullAccess"]

    return commands.check(predicate)


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():
示例#19
0
    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(client.courriel, {})
bot = commands.Bot(
    command_prefix=client.prefix,
    auth=fortnitepy.AdvancedAuth(
        email=client.courriel,
        password=client.wordpass,
        prompt_authorization_code=True,
        delete_existing_device_auths=True,
        **device_auth_details
    )
)

fortnite_api_async = FortniteAPIAsync.APIClient()

print(crayons.cyan('PY MAKER BY VAXS RSB YOUTUBE: https://www.youtube.com/channel/UCIK7oxSNPt8MCrphoL5MEPA'))
print(crayons.cyan('IF YOU WONT TO SUPPORT ME USE CODE VAXS-RSB IN THE ITEM SHOP'))

@bot.event()
async def event_ready():
    print('██████╗ ██╗   ██╗     ██████╗  ██████╗ ████████╗')
    print('██╔══██╗╚██╗ ██╔╝     ██╔══██╗██╔═══██╗╚══██╔══╝')
    print('██████╔╝ ╚████╔╝█████╗██████╔╝██║   ██║   ██║   ')
示例#20
0
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
async def event_ready():
    print('Fortnite bot ready')
示例#21
0
    db.commit()
cprint("[Client] Loaded Database", "green")


# 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'],
示例#22
0
import pkg_resources

from subprocess import call
from zipfile import ZipFile
from collections import namedtuple
from .utils import load_defaults, authorized, add_event_handlers, update_check

update_check()  # Update the cosmetics,playlists

app = sanic.Sanic('')
loop = asyncio.get_event_loop()

fn_client.settings = json.loads(open("settings.json").read())
fn_client = fortnitepy.Client(
    status=fn_client.settings['Open EZFN Settings']['Status'],
    auth=fortnitepy.AdvancedAuth(prompt_exchange_code=False,
                                 delete_existing_device_auths=True))
fn_client._start = False
fn_client.exception = ""

loop.create_task(add_event_handlers(fn_client))
loop.create_task(app.create_server(return_asyncio_server=True))  # Start sanic
load_defaults(fn_client)  # Load default party settings and other stuff


def _invalid_device_auth():
    settings = json.loads(open("settings.json").read())
    # Remove the not working account from the settings
    settings["account"]["deviceID"] = ""
    settings["account"]["accountID"] = ""
    settings["account"]["secret"] = ""
    open("settings.json",
示例#23
0

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, {})
client = fortnitepy.Client(
    auth=fortnitepy.AdvancedAuth(
        email=email,   #put email where it says email the second in quotations (eg. "*****@*****.**")
        password=password,       #put password where it says password the second time in quotations (eg. "password")
        prompt_exchange_code=True,
        delete_existing_device_auths=True,
        **device_auth_details
    )
)


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


@client.event
async def event_ready():
    global ready
    print('Client ready as {0.user.display_name}'.format(client))
示例#24
0
            openurl(
                "https://www.epicgames.com/id/login/epic?redirect_uri=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect%3FclientId%3D3446cd72694c4a4485d81b77adbb2141%26responseType%3Dcode"
            )

            with prompt_toolkit.patch_stdout.patch_stdout():
                try:
                    return_url = prompt_toolkit.prompt(
                        "Paste Here & Press Enter: ")
                except KeyboardInterrupt:
                    break

            authorization_code = json.loads(return_url)["redirectUrl"].split(
                "https://accounts.epicgames.com/fnauth?code=")
            log.info("Spinning Up Temporary Client...")
            client = fortnitepy.Client(auth=fortnitepy.AdvancedAuth(
                email=email,
                password=password,
                authorization_code=authorization_code))

            @client.event
            async def event_device_auth_generate(details: dict, email: str):
                global password
                c = db.cursor()
                c.execute("""INSERT INTO `accounts`
                    ('email', 'password', 'device_id', 'account_id', 'secret')
                    VALUES ('%s', '%s', '%s', '%s', '%s')""" %
                          (email, password, details["device_id"],
                           details["account_id"], details["secret"]))
                c.close()
                log.info("$GREENSaved Device Details! Shutting Down...")

            @client.event
示例#25
0
@dclient.event
async def on_message(message: discord.Message):
    if message.channel.id == 718979003968520283:
        if "start" in message.content.lower():
            await message.delete()
            await start_bot(message.author, 5400)
        else:
            await message.delete()
    elif type(message.channel) == discord.DMChannel:
        await parse_command(message)
for a in accounts:
    auth = fortnitepy.AdvancedAuth(
        email=accounts[a]['Email'],
        password=accounts[a]['Password'],
        account_id=accounts[a]['Account ID'],
        device_id=accounts[a]['Device ID'],
        secret=accounts[a]['Secret']
    )
    client = fortnitepy.Client(
        auth=auth,
        platform=fortnitepy.Platform.MAC
    )
    clients[a] = client
    available[a] = client

for s in (signal.SIGHUP, signal.SIGTERM, signal.SIGINT):
    loop.add_signal_handler(s, shutdown)

loop.set_exception_handler(loopexcepthook)
loop.run_forever()
示例#26
0

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

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


device_auth_details = get_device_auth_details().get(auth.email, {})

fortnite_client = fortnitepy.Client(
    auth=fortnitepy.AdvancedAuth(email=auth.email,
                                 password=auth.password,
                                 prompt_exchange_code=True,
                                 delete_existing_device_auths=True,
                                 **device_auth_details))

discord_bot = commands.Bot(command_prefix=const.CMD_PREFIX,
                           description='My discord + fortnite bot!',
                           case_insensitive=True)

setting = db.load_setting()

# region end


# region fortnite event
# ---------------------
@fortnite_client.event
示例#27
0
            return json.load(fp)
    return {}

def store_device_auth_details(email, details):
    existing = get_device_auth_details()
    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')
    ]
)
示例#28
0
文件: main.py 项目: hjvuvjr/mofo
    if data.get("Account ID", "") == "automagically-filled":
        return details  # Only return email if nothing else is present

    details["account_id"] = data.get("Account ID", "")
    details["device_id"] = data.get("Device ID", "")
    details["secret"] = data.get("Secret", "")
    return details  # Return saved details


## Loading Clients
clients = {}
for client in config:
    clients[client] = commands.Bot(command_prefix="",
                                   auth=fortnitepy.AdvancedAuth(
                                       prompt_authorization_code=True,
                                       **get_details(client)))
log.info(f"Loaded {len(config)} Clients.")

## Loading Extensions
for ext in os.listdir("extensions"):
    if ext.endswith(".py"):  # Simple Extensions
        try:
            for client in list(clients.values()):
                client.load_extension(f"extensions.{ext[:-3]}")
            log.info(f"$GREENLoaded Extension $CYAN{ext[:-3]}$GREEN.")
        except:
            log.warning(f"Cannot Load Extension $CYAN{ext}$YELLOW.")

    elif os.path.isdir(f"extensions/{ext}") and os.path.isfile(
            f"extensions/{ext}/main.py"):