aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas <[email protected]>2020-10-31 18:00:13 +0100
committerRapptz <[email protected]>2020-11-21 21:30:45 -0500
commit873ed87caa45b98c60d6d5c410132238f8b26d9e (patch)
treef943214381476b0de4b994023def15f61dda7e5b
parentImplement icon_rl_as and cover_image_url_as for AppInfo (diff)
downloaddiscord.py-873ed87caa45b98c60d6d5c410132238f8b26d9e.tar.xz
discord.py-873ed87caa45b98c60d6d5c410132238f8b26d9e.zip
Raise ClientException when members intent is not enabled on guild.fetch_members
-rw-r--r--discord/guild.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/discord/guild.py b/discord/guild.py
index 4faa0125..15ba364f 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -1236,7 +1236,8 @@ class Guild(Hashable):
def fetch_members(self, *, limit=1000, after=None):
"""|coro|
- Retrieves an :class:`.AsyncIterator` that enables receiving the guild's members.
+ Retrieves an :class:`.AsyncIterator` that enables receiving the guild's members. In order to use this,
+ :meth:`Intents.members` must be enabled.
.. note::
@@ -1257,6 +1258,8 @@ class Guild(Hashable):
Raises
------
+ ClientException
+ The members intent is not enabled.
HTTPException
Getting the members failed.
@@ -1278,6 +1281,10 @@ class Guild(Hashable):
members = await guild.fetch_members(limit=150).flatten()
# members is now a list of Member...
"""
+
+ if not self._state._intents.members:
+ raise ClientException('Intents.members must be enabled to use this.')
+
return MemberIterator(self, limit=limit, after=after)
async def fetch_member(self, member_id):