fix conflicts
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"""
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2020 Rapptz
|
||||
Copyright (c) 2015-present Rapptz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
@@ -33,6 +33,7 @@ from .enums import DefaultAvatar, RelationshipType, UserFlags, HypeSquadHouse, P
|
||||
from .errors import ClientException
|
||||
from .colour import Colour
|
||||
from .asset import Asset
|
||||
from .utils import deprecated
|
||||
|
||||
class Profile(namedtuple('Profile', 'flags user mutual_guilds connected_accounts premium_since')):
|
||||
__slots__ = ()
|
||||
@@ -123,6 +124,7 @@ class BaseUser(_BaseUser):
|
||||
self.avatar = user.avatar
|
||||
self.bot = user.bot
|
||||
self._state = user._state
|
||||
self._public_flags = user._public_flags
|
||||
|
||||
return self
|
||||
|
||||
@@ -272,11 +274,7 @@ class BaseUser(_BaseUser):
|
||||
if message.mention_everyone:
|
||||
return True
|
||||
|
||||
for user in message.mentions:
|
||||
if user.id == self.id:
|
||||
return True
|
||||
|
||||
return False
|
||||
return any(user.id == self.id for user in message.mentions)
|
||||
|
||||
class ClientUser(BaseUser):
|
||||
"""Represents your Discord user.
|
||||
@@ -317,17 +315,25 @@ class ClientUser(BaseUser):
|
||||
.. versionadded:: 1.3
|
||||
|
||||
verified: :class:`bool`
|
||||
Specifies if the user is a verified account.
|
||||
Specifies if the user's email is verified.
|
||||
email: Optional[:class:`str`]
|
||||
The email the user used when registering.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
locale: Optional[:class:`str`]
|
||||
The IETF language tag used to identify the language the user is using.
|
||||
mfa_enabled: :class:`bool`
|
||||
Specifies if the user has MFA turned on and working.
|
||||
premium: :class:`bool`
|
||||
Specifies if the user is a premium user (e.g. has Discord Nitro).
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
premium_type: Optional[:class:`PremiumType`]
|
||||
Specifies the type of premium a user has (e.g. Nitro or Nitro Classic). Could be None if the user is not premium.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
"""
|
||||
__slots__ = BaseUser.__slots__ + \
|
||||
('email', 'locale', '_flags', 'verified', 'mfa_enabled',
|
||||
@@ -352,9 +358,12 @@ class ClientUser(BaseUser):
|
||||
self.premium = data.get('premium', False)
|
||||
self.premium_type = try_enum(PremiumType, data.get('premium_type', None))
|
||||
|
||||
@deprecated()
|
||||
def get_relationship(self, user_id):
|
||||
"""Retrieves the :class:`Relationship` if applicable.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
@@ -375,6 +384,8 @@ class ClientUser(BaseUser):
|
||||
def relationships(self):
|
||||
"""List[:class:`User`]: Returns all the relationships that the user has.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
@@ -385,6 +396,8 @@ class ClientUser(BaseUser):
|
||||
def friends(self):
|
||||
r"""List[:class:`User`]: Returns all the users that the user is friends with.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
@@ -395,6 +408,8 @@ class ClientUser(BaseUser):
|
||||
def blocked(self):
|
||||
r"""List[:class:`User`]: Returns all the users that the user has blocked.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
@@ -409,6 +424,10 @@ class ClientUser(BaseUser):
|
||||
If a bot account is used then a password field is optional,
|
||||
otherwise it is required.
|
||||
|
||||
.. warning::
|
||||
|
||||
The user account-only fields are deprecated.
|
||||
|
||||
.. note::
|
||||
|
||||
To upload an avatar, a :term:`py:bytes-like object` must be passed in that
|
||||
@@ -500,6 +519,7 @@ class ClientUser(BaseUser):
|
||||
|
||||
self._update(data)
|
||||
|
||||
@deprecated()
|
||||
async def create_group(self, *recipients):
|
||||
r"""|coro|
|
||||
|
||||
@@ -507,6 +527,8 @@ class ClientUser(BaseUser):
|
||||
provided. These recipients must be have a relationship
|
||||
of type :attr:`RelationshipType.friend`.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
@@ -540,11 +562,14 @@ class ClientUser(BaseUser):
|
||||
data = await self._state.http.start_group(self.id, users)
|
||||
return GroupChannel(me=self, data=data, state=self._state)
|
||||
|
||||
@deprecated()
|
||||
async def edit_settings(self, **kwargs):
|
||||
"""|coro|
|
||||
|
||||
Edits the client user's settings.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
@@ -706,8 +731,22 @@ class User(BaseUser, discord.abc.Messageable):
|
||||
"""
|
||||
return self._state._get_private_channel_by_user(self.id)
|
||||
|
||||
@property
|
||||
def mutual_guilds(self):
|
||||
"""List[:class:`Guild`]: The guilds that the user shares with the client.
|
||||
|
||||
.. note::
|
||||
|
||||
This will only return mutual guilds within the client's internal cache.
|
||||
|
||||
.. versionadded:: 1.7
|
||||
"""
|
||||
return [guild for guild in self._state._guilds.values() if guild.get_member(self.id)]
|
||||
|
||||
async def create_dm(self):
|
||||
"""Creates a :class:`DMChannel` with this user.
|
||||
"""|coro|
|
||||
|
||||
Creates a :class:`DMChannel` with this user.
|
||||
|
||||
This should be rarely called, as this is done transparently for most
|
||||
people.
|
||||
@@ -729,17 +768,22 @@ class User(BaseUser, discord.abc.Messageable):
|
||||
def relationship(self):
|
||||
"""Optional[:class:`Relationship`]: Returns the :class:`Relationship` with this user if applicable, ``None`` otherwise.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
"""
|
||||
return self._state.user.get_relationship(self.id)
|
||||
|
||||
@deprecated()
|
||||
async def mutual_friends(self):
|
||||
"""|coro|
|
||||
|
||||
Gets all mutual friends of this user.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
@@ -760,9 +804,12 @@ class User(BaseUser, discord.abc.Messageable):
|
||||
mutuals = await state.http.get_mutual_friends(self.id)
|
||||
return [User(state=state, data=friend) for friend in mutuals]
|
||||
|
||||
@deprecated()
|
||||
def is_friend(self):
|
||||
""":class:`bool`: Checks if the user is your friend.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
@@ -772,9 +819,12 @@ class User(BaseUser, discord.abc.Messageable):
|
||||
return False
|
||||
return r.type is RelationshipType.friend
|
||||
|
||||
@deprecated()
|
||||
def is_blocked(self):
|
||||
""":class:`bool`: Checks if the user is blocked.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
@@ -784,11 +834,14 @@ class User(BaseUser, discord.abc.Messageable):
|
||||
return False
|
||||
return r.type is RelationshipType.blocked
|
||||
|
||||
@deprecated()
|
||||
async def block(self):
|
||||
"""|coro|
|
||||
|
||||
Blocks the user.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
@@ -803,11 +856,14 @@ class User(BaseUser, discord.abc.Messageable):
|
||||
|
||||
await self._state.http.add_relationship(self.id, type=RelationshipType.blocked.value)
|
||||
|
||||
@deprecated()
|
||||
async def unblock(self):
|
||||
"""|coro|
|
||||
|
||||
Unblocks the user.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
@@ -821,11 +877,14 @@ class User(BaseUser, discord.abc.Messageable):
|
||||
"""
|
||||
await self._state.http.remove_relationship(self.id)
|
||||
|
||||
@deprecated()
|
||||
async def remove_friend(self):
|
||||
"""|coro|
|
||||
|
||||
Removes the user as a friend.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
@@ -839,11 +898,14 @@ class User(BaseUser, discord.abc.Messageable):
|
||||
"""
|
||||
await self._state.http.remove_relationship(self.id)
|
||||
|
||||
@deprecated()
|
||||
async def send_friend_request(self):
|
||||
"""|coro|
|
||||
|
||||
Sends the user a friend request.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
@@ -857,11 +919,14 @@ class User(BaseUser, discord.abc.Messageable):
|
||||
"""
|
||||
await self._state.http.send_friend_request(username=self.name, discriminator=self.discriminator)
|
||||
|
||||
@deprecated()
|
||||
async def profile(self):
|
||||
"""|coro|
|
||||
|
||||
Gets the user's profile.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
|
Reference in New Issue
Block a user