mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-03 10:32:42 +00:00
Deprecate non-bot methods
This commit is contained in:
parent
1cbc537734
commit
427e387a2f
@ -36,6 +36,8 @@ class CallMessage:
|
||||
This is only received in cases where the message type is equivalent to
|
||||
:attr:`MessageType.call`.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
Attributes
|
||||
-----------
|
||||
ended_timestamp: Optional[:class:`datetime.datetime`]
|
||||
@ -53,12 +55,18 @@ class CallMessage:
|
||||
|
||||
@property
|
||||
def call_ended(self):
|
||||
""":class:`bool`: Indicates if the call has ended."""
|
||||
""":class:`bool`: Indicates if the call has ended.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
"""
|
||||
return self.ended_timestamp is not None
|
||||
|
||||
@property
|
||||
def channel(self):
|
||||
r""":class:`GroupChannel`\: The private channel associated with this message."""
|
||||
r""":class:`GroupChannel`\: The private channel associated with this message.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
"""
|
||||
return self.message.channel
|
||||
|
||||
@property
|
||||
@ -68,6 +76,8 @@ class CallMessage:
|
||||
If the call has not ended then the current duration will
|
||||
be returned.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
Returns
|
||||
---------
|
||||
:class:`datetime.timedelta`
|
||||
@ -83,6 +93,8 @@ class GroupCall:
|
||||
|
||||
This is accompanied with a :class:`CallMessage` denoting the information.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
Attributes
|
||||
-----------
|
||||
call: :class:`CallMessage`
|
||||
@ -122,7 +134,10 @@ class GroupCall:
|
||||
|
||||
@property
|
||||
def connected(self):
|
||||
"""List[:class:`User`]: A property that returns all users that are currently in this call."""
|
||||
"""List[:class:`User`]: A property that returns all users that are currently in this call.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
"""
|
||||
ret = [u for u in self.channel.recipients if self.voice_state_for(u) is not None]
|
||||
me = self.channel.me
|
||||
if self.voice_state_for(me) is not None:
|
||||
@ -132,15 +147,21 @@ class GroupCall:
|
||||
|
||||
@property
|
||||
def channel(self):
|
||||
r""":class:`GroupChannel`\: Returns the channel the group call is in."""
|
||||
r""":class:`GroupChannel`\: Returns the channel the group call is in.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
"""
|
||||
return self.call.channel
|
||||
|
||||
@utils.deprecated()
|
||||
def voice_state_for(self, user):
|
||||
"""Retrieves the :class:`VoiceState` for a specified :class:`User`.
|
||||
|
||||
If the :class:`User` has no voice state then this function returns
|
||||
``None``.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
Parameters
|
||||
------------
|
||||
user: :class:`User`
|
||||
|
@ -347,7 +347,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
||||
bulk: :class:`bool`
|
||||
If ``True``, use bulk delete. Setting this to ``False`` is useful for mass-deleting
|
||||
a bot's own messages without :attr:`Permissions.manage_messages`. When ``True``, will
|
||||
fall back to single delete if current account is a user bot, or if messages are
|
||||
fall back to single delete if current account is a user bot (now deprecated), or if messages are
|
||||
older than two weeks.
|
||||
|
||||
Raises
|
||||
@ -1274,6 +1274,7 @@ class GroupChannel(discord.abc.Messageable, Hashable):
|
||||
|
||||
return base
|
||||
|
||||
@utils.deprecated()
|
||||
async def add_recipients(self, *recipients):
|
||||
r"""|coro|
|
||||
|
||||
@ -1284,6 +1285,8 @@ class GroupChannel(discord.abc.Messageable, Hashable):
|
||||
add a recipient to the group, you must have a relationship
|
||||
with the user of type :attr:`RelationshipType.friend`.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
\*recipients: :class:`User`
|
||||
@ -1301,11 +1304,14 @@ class GroupChannel(discord.abc.Messageable, Hashable):
|
||||
for recipient in recipients:
|
||||
await req(self.id, recipient.id)
|
||||
|
||||
@utils.deprecated()
|
||||
async def remove_recipients(self, *recipients):
|
||||
r"""|coro|
|
||||
|
||||
Removes recipients from this group.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
\*recipients: :class:`User`
|
||||
@ -1323,11 +1329,14 @@ class GroupChannel(discord.abc.Messageable, Hashable):
|
||||
for recipient in recipients:
|
||||
await req(self.id, recipient.id)
|
||||
|
||||
@utils.deprecated()
|
||||
async def edit(self, **fields):
|
||||
"""|coro|
|
||||
|
||||
Edits the group.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
name: Optional[:class:`str`]
|
||||
|
@ -495,6 +495,8 @@ class Client:
|
||||
Keyword argument that specifies if the account logging on is a bot
|
||||
token or not.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
Raises
|
||||
------
|
||||
:exc:`.LoginFailure`
|
||||
@ -1385,11 +1387,14 @@ class Client:
|
||||
data = await self.http.get_user(user_id)
|
||||
return User(state=self._connection, data=data)
|
||||
|
||||
@utils.deprecated()
|
||||
async def fetch_user_profile(self, user_id):
|
||||
"""|coro|
|
||||
|
||||
Gets an arbitrary user's profile.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This can only be used by non-bot accounts.
|
||||
|
@ -1974,6 +1974,7 @@ class Guild(Hashable):
|
||||
payload['max_age'] = 0
|
||||
return Invite(state=self._state, data=payload)
|
||||
|
||||
@utils.deprecated()
|
||||
def ack(self):
|
||||
"""|coro|
|
||||
|
||||
@ -1981,6 +1982,8 @@ class Guild(Hashable):
|
||||
|
||||
The user must not be a bot user.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
Raises
|
||||
-------
|
||||
HTTPException
|
||||
|
@ -415,6 +415,9 @@ class Message(Hashable):
|
||||
call: Optional[:class:`CallMessage`]
|
||||
The call that the message refers to. This is only applicable to messages of type
|
||||
:attr:`MessageType.call`.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
reference: Optional[:class:`~discord.MessageReference`]
|
||||
The message that this message references. This is only applicable to messages of
|
||||
type :attr:`MessageType.pins_add`, crossposted messages created by a
|
||||
@ -1244,6 +1247,7 @@ class Message(Hashable):
|
||||
"""
|
||||
await self._state.http.clear_reactions(self.channel.id, self.id)
|
||||
|
||||
@utils.deprecated()
|
||||
async def ack(self):
|
||||
"""|coro|
|
||||
|
||||
@ -1251,6 +1255,8 @@ class Message(Hashable):
|
||||
|
||||
The user must not be a bot user.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
Raises
|
||||
-------
|
||||
HTTPException
|
||||
|
@ -25,6 +25,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from .enums import RelationshipType, try_enum
|
||||
from . import utils
|
||||
|
||||
class Relationship:
|
||||
"""Represents a relationship in Discord.
|
||||
@ -32,6 +33,8 @@ class Relationship:
|
||||
A relationship is like a friendship, a person who is blocked, etc.
|
||||
Only non-bot accounts can have relationships.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
Attributes
|
||||
-----------
|
||||
user: :class:`User`
|
||||
@ -50,11 +53,14 @@ class Relationship:
|
||||
def __repr__(self):
|
||||
return '<Relationship user={0.user!r} type={0.type!r}>'.format(self)
|
||||
|
||||
@utils.deprecated()
|
||||
async def delete(self):
|
||||
"""|coro|
|
||||
|
||||
Deletes the relationship.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
Raises
|
||||
------
|
||||
HTTPException
|
||||
@ -63,12 +69,15 @@ class Relationship:
|
||||
|
||||
await self._state.http.remove_relationship(self.user.id)
|
||||
|
||||
@utils.deprecated()
|
||||
async def accept(self):
|
||||
"""|coro|
|
||||
|
||||
Accepts the relationship request. e.g. accepting a
|
||||
friend request.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
Raises
|
||||
-------
|
||||
HTTPException
|
||||
|
@ -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__ = ()
|
||||
@ -321,14 +322,22 @@ class ClientUser(BaseUser):
|
||||
Specifies if the user is a verified account.
|
||||
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',
|
||||
@ -353,9 +362,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.
|
||||
@ -376,6 +388,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.
|
||||
@ -386,6 +400,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.
|
||||
@ -396,6 +412,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.
|
||||
@ -410,6 +428,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
|
||||
@ -501,6 +523,7 @@ class ClientUser(BaseUser):
|
||||
|
||||
self._update(data)
|
||||
|
||||
@deprecated()
|
||||
async def create_group(self, *recipients):
|
||||
r"""|coro|
|
||||
|
||||
@ -508,6 +531,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.
|
||||
@ -541,11 +566,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.
|
||||
@ -748,11 +776,14 @@ class User(BaseUser, discord.abc.Messageable):
|
||||
"""
|
||||
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.
|
||||
@ -773,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.
|
||||
@ -785,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.
|
||||
@ -797,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.
|
||||
@ -816,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.
|
||||
@ -834,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.
|
||||
@ -852,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.
|
||||
@ -870,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.
|
||||
|
16
docs/api.rst
16
docs/api.rst
@ -894,6 +894,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
|
||||
Called when a :class:`Relationship` is added or removed from the
|
||||
:class:`ClientUser`.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
:param relationship: The relationship that was added or removed.
|
||||
:type relationship: :class:`Relationship`
|
||||
|
||||
@ -902,6 +904,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
|
||||
Called when a :class:`Relationship` is updated, e.g. when you
|
||||
block a friend or a friendship is accepted.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
:param before: The previous relationship status.
|
||||
:type before: :class:`Relationship`
|
||||
:param after: The updated relationship status.
|
||||
@ -937,6 +941,8 @@ Profile
|
||||
|
||||
A namedtuple representing a user's Discord public profile.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. attribute:: user
|
||||
|
||||
The :class:`User` the profile belongs to.
|
||||
@ -1892,6 +1898,8 @@ of :class:`enum.Enum`.
|
||||
|
||||
Specifies the type of :class:`Relationship`.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This only applies to users, *not* bots.
|
||||
@ -1918,6 +1926,8 @@ of :class:`enum.Enum`.
|
||||
Represents the options found in ``Settings > Privacy & Safety > Safe Direct Messaging``
|
||||
in the Discord client.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This only applies to users, *not* bots.
|
||||
@ -1940,6 +1950,8 @@ of :class:`enum.Enum`.
|
||||
Represents the options found in ``Settings > Privacy & Safety > Who Can Add You As A Friend``
|
||||
in the Discord client.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This only applies to users, *not* bots.
|
||||
@ -1969,6 +1981,8 @@ of :class:`enum.Enum`.
|
||||
|
||||
Represents the user's Discord Nitro subscription type.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This only applies to users, *not* bots.
|
||||
@ -1986,6 +2000,8 @@ of :class:`enum.Enum`.
|
||||
|
||||
Represents the theme synced across all Discord clients.
|
||||
|
||||
.. deprecated:: 1.7
|
||||
|
||||
.. note::
|
||||
|
||||
This only applies to users, *not* bots.
|
||||
|
Loading…
x
Reference in New Issue
Block a user