added versionadded
This commit is contained in:
@@ -27,6 +27,7 @@ Custom Features
|
|||||||
- Added ``Intents.from_list``
|
- Added ``Intents.from_list``
|
||||||
- Added support for ``int()`` to ``discord.User``, ``discord.Member``, ``discord.Emoji``, ``discord.Role``, ``discord.Guild``, ``discord.Message``, ``discord.TextChannel``, ``discord.VoiceChannel``, ``discord.CategoryChannel``, ``discord.Attachment`` and ``discord.Message``. This will return their id
|
- Added support for ``int()`` to ``discord.User``, ``discord.Member``, ``discord.Emoji``, ``discord.Role``, ``discord.Guild``, ``discord.Message``, ``discord.TextChannel``, ``discord.VoiceChannel``, ``discord.CategoryChannel``, ``discord.Attachment`` and ``discord.Message``. This will return their id
|
||||||
- Added support for ``str()`` to ``discord.Message``. This will return the message content
|
- Added support for ``str()`` to ``discord.Message``. This will return the message content
|
||||||
|
- Added ``Guild.try_member``
|
||||||
|
|
||||||
Key Features
|
Key Features
|
||||||
-------------
|
-------------
|
||||||
@@ -46,10 +47,10 @@ To install the library without full voice support, you can just run the followin
|
|||||||
.. code:: sh
|
.. code:: sh
|
||||||
|
|
||||||
# Linux/macOS
|
# Linux/macOS
|
||||||
python3 -m pip install -U git+https://github.com/iDutchy/discord.py
|
python3 -m pip install -U enhanced-dpy
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
py -3 -m pip install -U git+https://github.com/iDutchy/discord.py
|
py -3 -m pip install -U enhanced-dpy
|
||||||
|
|
||||||
To install the development version, do the following:
|
To install the development version, do the following:
|
||||||
|
|
||||||
|
|||||||
@@ -144,7 +144,9 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def can_send(self):
|
def can_send(self):
|
||||||
""":class:`bool`: Checks if the bot can send messages"""
|
""":class:`bool`: Checks if the bot can send messages
|
||||||
|
|
||||||
|
.. versionadded:: 1.5.0.1"""
|
||||||
return self.guild.me.guild_permissions.send_messages
|
return self.guild.me.guild_permissions.send_messages
|
||||||
|
|
||||||
def permissions_for(self, member):
|
def permissions_for(self, member):
|
||||||
|
|||||||
@@ -226,6 +226,8 @@ class Client:
|
|||||||
remove the need to set the color per embed, but can still be overridden by setting a
|
remove the need to set the color per embed, but can still be overridden by setting a
|
||||||
color while creating an instance of an embed.
|
color while creating an instance of an embed.
|
||||||
|
|
||||||
|
.. versionadded:: 1.5.0.1
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
-----------
|
-----------
|
||||||
ws
|
ws
|
||||||
@@ -294,6 +296,8 @@ class Client:
|
|||||||
|
|
||||||
This will raise a TypeError if an improper format was passed.
|
This will raise a TypeError if an improper format was passed.
|
||||||
|
|
||||||
|
.. versionadded:: 1.5.0.1
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
-----------
|
-----------
|
||||||
color: Union[:class:`.Colour`, :class:`int`]
|
color: Union[:class:`.Colour`, :class:`int`]
|
||||||
@@ -1410,6 +1414,8 @@ class Client:
|
|||||||
Retrieves a :class:`~discord.User` based on their ID. This can only
|
Retrieves a :class:`~discord.User` based on their ID. This can only
|
||||||
be used by bot accounts.
|
be used by bot accounts.
|
||||||
|
|
||||||
|
.. versionadded:: 1.5.0.1
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
This will first attempt to get the user from the cache.
|
This will first attempt to get the user from the cache.
|
||||||
|
|||||||
@@ -128,14 +128,18 @@ class BotBase(GroupMixin):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def owner(self):
|
def owner(self):
|
||||||
""":class:`discord.User`: The owner, retrieved from owner_id. In case of improper caching, this can return None"""
|
""":class:`discord.User`: The owner, retrieved from owner_id. In case of improper caching, this can return None
|
||||||
|
|
||||||
|
.. versionadded:: 1.5.0.1"""
|
||||||
if not self.owner_id or self.owner_ids:
|
if not self.owner_id or self.owner_ids:
|
||||||
raise AttributeError('No owner_id specified or you used owner_ids. If you used owner_ids, please refer to `Bot.owners`')
|
raise AttributeError('No owner_id specified or you used owner_ids. If you used owner_ids, please refer to `Bot.owners`')
|
||||||
return self.get_user(self.owner_id)
|
return self.get_user(self.owner_id)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def owners(self):
|
def owners(self):
|
||||||
"""List[:class:`discord.User`]: The owners, retrieved from owner_ids. In case of improper caching, this list may not contain all owners."""
|
"""List[:class:`discord.User`]: The owners, retrieved from owner_ids. In case of improper caching, this list may not contain all owners.
|
||||||
|
|
||||||
|
.. versionadded:: 1.5.0.1"""
|
||||||
if not self.owner_ids or self.owner_id:
|
if not self.owner_ids or self.owner_id:
|
||||||
raise TypeError('No owner_ids specified or you used owner_id. If you used owner_id, please refer to `Bot.owner`')
|
raise TypeError('No owner_ids specified or you used owner_id. If you used owner_id, please refer to `Bot.owner`')
|
||||||
owners = []
|
owners = []
|
||||||
|
|||||||
@@ -405,7 +405,9 @@ class Intents(BaseFlags):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def from_list(cls, intents_list):
|
def from_list(cls, intents_list):
|
||||||
"""A factory method that creates a :class:`Intents` with everything enabled
|
"""A factory method that creates a :class:`Intents` with everything enabled
|
||||||
that has been passed in the list."""
|
that has been passed in the list.
|
||||||
|
|
||||||
|
.. versionadded:: 1.5.0.1"""
|
||||||
for item in intents_list:
|
for item in intents_list:
|
||||||
if item not in cls.VALID_FLAGS.keys():
|
if item not in cls.VALID_FLAGS.keys():
|
||||||
intents_list.remove(item)
|
intents_list.remove(item)
|
||||||
|
|||||||
@@ -520,12 +520,16 @@ class Guild(Hashable):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def bots(self):
|
def bots(self):
|
||||||
"""List[:class:`Member`]: A list of bots that belong to this guild."""
|
"""List[:class:`Member`]: A list of bots that belong to this guild.
|
||||||
|
|
||||||
|
.. versionadded:: 1.5.0.1"""
|
||||||
return list(m for m in self._members.values() if m.bot)
|
return list(m for m in self._members.values() if m.bot)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def humans(self):
|
def humans(self):
|
||||||
"""List[:class:`Member`]: A list of humans that belong to this guild."""
|
"""List[:class:`Member`]: A list of humans that belong to this guild.
|
||||||
|
|
||||||
|
.. versionadded:: 1.5.0.1"""
|
||||||
return list(m for m in self._members.values() if not m.bot)
|
return list(m for m in self._members.values() if not m.bot)
|
||||||
|
|
||||||
def get_member(self, user_id):
|
def get_member(self, user_id):
|
||||||
@@ -1293,6 +1297,42 @@ class Guild(Hashable):
|
|||||||
"""
|
"""
|
||||||
return MemberIterator(self, limit=limit, after=after)
|
return MemberIterator(self, limit=limit, after=after)
|
||||||
|
|
||||||
|
async def try_member(self, member_id):
|
||||||
|
"""|coro|
|
||||||
|
|
||||||
|
Retreives a :class:`Member` from a guild ID, and a member ID.
|
||||||
|
|
||||||
|
.. versionadded:: 1.5.1.2
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
This will first attempt to get the member from the cache.
|
||||||
|
If that fails, it will make an API call.
|
||||||
|
This method is an API call. For general usage, consider :meth:`get_member` instead.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
-----------
|
||||||
|
member_id: :class:`int`
|
||||||
|
The member's ID to fetch from.
|
||||||
|
|
||||||
|
Raises
|
||||||
|
-------
|
||||||
|
Forbidden
|
||||||
|
You do not have access to the guild.
|
||||||
|
HTTPException
|
||||||
|
Fetching the member failed.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
--------
|
||||||
|
:class:`Member`
|
||||||
|
The member from the member ID.
|
||||||
|
"""
|
||||||
|
|
||||||
|
member = self.get_member(member_id)
|
||||||
|
if member is None:
|
||||||
|
member = await self.fetch_member(member_id)
|
||||||
|
return member
|
||||||
|
|
||||||
async def fetch_member(self, member_id):
|
async def fetch_member(self, member_id):
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ Custom Features
|
|||||||
- Added ``Intents.from_list``
|
- Added ``Intents.from_list``
|
||||||
- Added support for ``int()`` to ``discord.User``, ``discord.Member``, ``discord.Emoji``, ``discord.Role``, ``discord.Guild``, ``discord.Message``, ``discord.TextChannel``, ``discord.VoiceChannel``, ``discord.CategoryChannel``, ``discord.Attachment`` and ``discord.Message``. This will return their id
|
- Added support for ``int()`` to ``discord.User``, ``discord.Member``, ``discord.Emoji``, ``discord.Role``, ``discord.Guild``, ``discord.Message``, ``discord.TextChannel``, ``discord.VoiceChannel``, ``discord.CategoryChannel``, ``discord.Attachment`` and ``discord.Message``. This will return their id
|
||||||
- Added support for ``str()`` to ``discord.Message``. This will return the message content
|
- Added support for ``str()`` to ``discord.Message``. This will return the message content
|
||||||
|
- Added ``Guild.try_member``
|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|||||||
Reference in New Issue
Block a user