Esempio n. 1
0
    def modify_current_user(self, args: dict) -> typing.Any:
        """Modify current discord User


        Parameters
        ----------
        args: typing.Dict
                A dictionary containing the changes to the current user. This has to be either
                their username, avatar or both

        Example
        -------
        ```py
        >>> some_api_instance.modify_current_user({'username' : 'FroggyMan', 'avatar' : 'https://cdn.discordapp.com/avatars/753561575532658738/0cf89f88a3ba4e226c6f1c72a9242dd8.png'})

            User(id=753561575532658738, username=Zenora, discriminator=6423, avatar_url=https://cdn.discordapp.com/avatars/753561575532658738/380c68e7a6752e347ed875c2e11a05c4.png?size=1024,
            flags=0, mention=<@753561575532658738>, bot=True, mfa_enabled=True, locale=en-US, verified=True,)
        ```

        Returns
        -------
        zenora.users.User
                Zenora user object

        """
        if "avatar" in args:
            args["avatar"] = zenora.File(args["avatar"]).data
        response = Query(self.token, self.token_type).modify_me(args)
        return model_factory.parse_user(response=response, app=self)
Esempio n. 2
0
    def get_user(self, snowflake: int) -> typing.Any:
        """Fetch Dicord User

        This has to be the user's snowflake ID


        Parameters
        ----------

        snowflake: int
                The ID of the Discord User

        Returns
        -------
        zenora.users.User
                Zenora user object

        """
        if not self.testing:
            response = Query(self.token, self.token_type).user(snowflake)
        else:
            response = {
                "id": "479287754400989217",
                "username": "******",
                "avatar": "9ab336b1e0506f6549d708591991d195",
                "discriminator": "4346",
                "public_flags": 128,
            }
        return model_factory.parse_user(response=response, app=self)
Esempio n. 3
0
    def get_current_user(self) -> typing.Any:
        """Fetch the current Dicord User


        Returns
        -------
        zenora.users.User
                Zenora user object

        """
        response = Query(self.token, self.token_type).current_user()
        return model_factory.parse_user(response=response, app=self)
Esempio n. 4
0
    def get_user(self, snowflake: int) -> typing.Any:
        """Fetch Dicord User

        This has to be the user's snowflake ID


        Parameters
        ----------

        snowflake: int
                The channel ID of the specific channel you want to fetch

        Returns
        -------
        zenora.users.PartialUser
                Zenora partial user object

        """
        response = Query(self.token, self.token_type).user(snowflake)
        return model_factory.parse_user(response, snowflake)
Esempio n. 5
0
    def get_user(self, snowflake: int) -> typing.Any:
        """Fetch Dicord User

        This has to be the user's snowflake ID


        Parameters
        ----------

        snowflake: int
                The ID of the Discord User

        Returns
        -------
        zenora.users.User
                Zenora user object

        """
        response = Query(self.token, self.token_type).user(snowflake)
        return model_factory.parse_user(response=response, app=self)
Esempio n. 6
0
    def get_current_user(self) -> typing.Any:
        """Fetch the current Dicord User


        Returns
        -------
        zenora.users.User
                Zenora user object

        """
        if not self.testing:
            response = Query(self.token, self.token_type).current_user()
        else:
            response = {
                "id": "479287754400989217",
                "username": "******",
                "avatar": "9ab336b1e0506f6549d708591991d195",
                "discriminator": "4346",
                "public_flags": 128,
            }
        return model_factory.parse_user(response=response, app=self)
Esempio n. 7
0
    def modify_current_user(self, args: dict) -> typing.Any:
        """Modify current discord User


        Parameters
        ----------
        args: typing.Dict
                A dictionary containing the changes to the current user. This has to be either
                their username, avatar or both

        Example
        -------
        .. code-block:: python


            >>> some_api_instance.modify_current_user({'username' : 'FroggyMan', 'avatar' : 'https://cdn.discordapp.com/avatars/753561575532658738/0cf89f88a3ba4e226c6f1c72a9242dd8.png'})
            User(id=753561575532658738, username=Zenora, discriminator=6423, avatar_url=https://cdn.discordapp.com/avatars/753561575532658738/380c68e7a6752e347ed875c2e11a05c4.png?size=1024,
            flags=0, mention=<@753561575532658738>, bot=True, mfa_enabled=True, locale=en-US, verified=True,)


        Returns
        -------
        zenora.users.User
                Zenora user object

        """
        if not self.testing:
            if "avatar" in args:
                args["avatar"] = zenora.File(args["avatar"]).data
            response = Query(self.token, self.token_type).modify_me(args)
        else:
            response = {
                "id": "479287754400989217",
                "username": "******",
                "avatar": "9ab336b1e0506f6549d708591991d195",
                "discriminator": "4346",
                "public_flags": 128,
            }
        return model_factory.parse_user(response=response, app=self)