aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaya <[email protected]>2021-02-21 18:12:30 +1300
committerGitHub <[email protected]>2021-02-21 00:12:30 -0500
commit66b834b3323c8d9403b2cb8f29b2e00d633bb1cc (patch)
treee585d75d13485db234dc9f81886fb5ea096024ea
parentDocument behavior of on_disconnect (diff)
downloaddiscord.py-66b834b3323c8d9403b2cb8f29b2e00d633bb1cc.tar.xz
discord.py-66b834b3323c8d9403b2cb8f29b2e00d633bb1cc.zip
Document BanEntry
-rw-r--r--discord/guild.py19
-rw-r--r--docs/api.rst16
2 files changed, 22 insertions, 13 deletions
diff --git a/discord/guild.py b/discord/guild.py
index a13c3336..caba7376 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -1346,9 +1346,7 @@ class Guild(Hashable):
async def fetch_ban(self, user):
"""|coro|
- Retrieves the :class:`BanEntry` for a user, which is a namedtuple
- with a ``user`` and ``reason`` field. See :meth:`bans` for more
- information.
+ Retrieves the :class:`BanEntry` for a user.
You must have the :attr:`~Permissions.ban_members` permission
to get this information.
@@ -1369,8 +1367,8 @@ class Guild(Hashable):
Returns
-------
- BanEntry
- The BanEntry object for the specified user.
+ :class:`BanEntry`
+ The :class:`BanEntry` object for the specified user.
"""
data = await self._state.http.get_ban(user.id, self.id)
return BanEntry(
@@ -1381,12 +1379,7 @@ class Guild(Hashable):
async def bans(self):
"""|coro|
- Retrieves all the users that are banned from the guild.
-
- This coroutine returns a :class:`list` of BanEntry objects, which is a
- namedtuple with a ``user`` field to denote the :class:`User`
- that got banned along with a ``reason`` field specifying
- why the user was banned that could be set to ``None``.
+ Retrieves all the users that are banned from the guild as a :class:`list` of :class:`BanEntry`.
You must have the :attr:`~Permissions.ban_members` permission
to get this information.
@@ -1400,8 +1393,8 @@ class Guild(Hashable):
Returns
--------
- List[BanEntry]
- A list of BanEntry objects.
+ List[:class:`BanEntry`]
+ A list of :class:`BanEntry` objects.
"""
data = await self._state.http.get_bans(self.id)
diff --git a/docs/api.rst b/docs/api.rst
index 35da0571..9146b318 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -2867,6 +2867,22 @@ Guild
.. automethod:: audit_logs
:async-for:
+.. class:: BanEntry
+
+ A namedtuple which represents a ban returned from :meth:`~Guild.bans`.
+
+ .. attribute:: reason
+
+ The reason this user was banned.
+
+ :type: Optional[:class:`str`]
+ .. attribute:: user
+
+ The :class:`User` that was banned.
+
+ :type: :class:`User`
+
+
Integration
~~~~~~~~~~~~