How to use the fortnitepy.user.UserBase function in fortnitepy

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 Terbau / fortnitepy / fortnitepy / user.py View on Github external
break

        self._external_auths = ext_list

    def _update_epicgames_display_name(self, display_name: str) -> None:
        self._epicgames_display_name = display_name

    def get_raw(self) -> dict:
        return {
            'displayName': self.display_name,
            'id': self.id,
            'externalAuths': [ext.get_raw() for ext in self._external_auths]
        }


class ClientUser(UserBase):
    """Represents the user the client is connected to.

    Attributes
    ----------
    client: :class:`Client`
        The client.
    age_group: :class:`str`
        The age group of the user.
    can_update_display_name: :class:`bool`
        ``True`` if the user can update it's displayname else ``False``
    country: :class:`str`
        The country the user wasregistered in.
    email: :class:`str`
        The email of the user.
    failed_login_attempts: :class:`str`
        Failed login attempts
github Terbau / fortnitepy / fortnitepy / user.py View on Github external
n_changes = data['numberOfDisplayNameChanges']
        self.number_of_display_name_changes = n_changes
        self.age_group = data['ageGroup']
        self.headless = data['headless']
        self.country = data['country']
        self.last_name = data['lastName']
        self.preferred_language = data['preferredLanguage']
        self.can_update_display_name = data['canUpdateDisplayName']
        self.tfa_enabled = data['tfaEnabled']
        self.email_verified = data['emailVerified']
        self.minor_verified = data['minorVerified']
        self.minor_expected = data['minorExpected']
        self.minor_status = data['minorStatus']


class User(UserBase):
    """Represents a user from Fortnite"""

    __slots__ = UserBase.__slots__

    def __init__(self, client: 'Client', data: dict, **kwargs: Any) -> None:
        super().__init__(client, data)

    def __repr__(self) -> str:
        return (''.format(self))

    async def block(self) -> None:
        """|coro|

        Blocks this user.
github Terbau / fortnitepy / fortnitepy / friend.py View on Github external
from typing import TYPE_CHECKING, List, Optional
from aioxmpp import JID

from .user import UserBase, ExternalAuth
from .errors import PartyError, Forbidden, HTTPException
from .presence import Presence
from .enums import Platform

if TYPE_CHECKING:
    from .client import Client
    from .party import ClientParty


class FriendBase(UserBase):

    __slots__ = UserBase.__slots__ + \
                ('_status', '_direction', '_favorite', '_created_at')

    def __init__(self, client: 'Client', data: dict) -> None:
        super().__init__(client, data)

    def _update(self, data: dict) -> None:
        super()._update(data)
        self._status = data['status']
        self._direction = data['direction']
        self._created_at = self.client.from_iso(data['created'])

    @property
    def display_name(self) -> str:
        """:class:`str`: The friend's displayname"""
        return super().display_name
github Terbau / fortnitepy / fortnitepy / friend.py View on Github external
import datetime

from typing import TYPE_CHECKING, List, Optional
from aioxmpp import JID

from .user import UserBase, ExternalAuth
from .errors import PartyError, Forbidden, HTTPException
from .presence import Presence
from .enums import Platform

if TYPE_CHECKING:
    from .client import Client
    from .party import ClientParty


class FriendBase(UserBase):

    __slots__ = UserBase.__slots__ + \
                ('_status', '_direction', '_favorite', '_created_at')

    def __init__(self, client: 'Client', data: dict) -> None:
        super().__init__(client, data)

    def _update(self, data: dict) -> None:
        super()._update(data)
        self._status = data['status']
        self._direction = data['direction']
        self._created_at = self.client.from_iso(data['created'])

    @property
    def display_name(self) -> str:
        """:class:`str`: The friend's displayname"""
github Terbau / fortnitepy / fortnitepy / user.py View on Github external
"""|coro|

        Blocks this user.

        Raises
        ------
        HTTPException
            Something went wrong while blocking this user.
        """
        await self.client.block_user(self.id)


class BlockedUser(UserBase):
    """Represents a blocked user from Fortnite"""

    __slots__ = UserBase.__slots__

    def __init__(self, client: 'Client', data: dict) -> None:
        super().__init__(client, data)

    def __repr__(self) -> str:
        return (''.format(self))

    async def unblock(self) -> None:
        """|coro|

        Unblocks this friend.
        """
        await self.client.unblock_user(self.id)
github Terbau / fortnitepy / fortnitepy / user.py View on Github external
'epicgames_account={0.epicgames_account!r}>'.format(self))

    async def block(self) -> None:
        """|coro|

        Blocks this user.

        Raises
        ------
        HTTPException
            Something went wrong while blocking this user.
        """
        await self.client.block_user(self.id)


class BlockedUser(UserBase):
    """Represents a blocked user from Fortnite"""

    __slots__ = UserBase.__slots__

    def __init__(self, client: 'Client', data: dict) -> None:
        super().__init__(client, data)

    def __repr__(self) -> str:
        return (''.format(self))

    async def unblock(self) -> None:
        """|coro|

        Unblocks this friend.