aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-02-28 23:37:11 -0500
committerRapptz <[email protected]>2021-02-28 23:56:14 -0500
commit4c4d75dc2934ac056150b41c8b0aa5cb998b66b8 (patch)
tree5bf6f8590c10ac8bea6e2578d2209455fdc159a6
parentAdd guild_id attribute to RawMessageUpdateEvent (diff)
downloaddiscord.py-4c4d75dc2934ac056150b41c8b0aa5cb998b66b8.tar.xz
discord.py-4c4d75dc2934ac056150b41c8b0aa5cb998b66b8.zip
Disallow empty sequences in Guild.query_members user_id parameter
-rw-r--r--discord/guild.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/discord/guild.py b/discord/guild.py
index 025448dd..92d9a59e 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -1460,10 +1460,10 @@ class Guild(Hashable):
data = await self._state.http.prune_members(self.id, days, compute_prune_count=compute_prune_count, roles=roles, reason=reason)
return data['pruned']
-
+
async def templates(self):
"""|coro|
-
+
Gets the list of templates from this guild.
Requires :attr:`~.Permissions.manage_guild` permissions.
@@ -1474,7 +1474,7 @@ class Guild(Hashable):
-------
Forbidden
You don't have permissions to get the templates.
-
+
Returns
--------
List[:class:`Template`]
@@ -1569,10 +1569,10 @@ class Guild(Hashable):
result.append(Invite(state=self._state, data=invite))
return result
-
+
async def create_template(self, *, name, description=None):
"""|coro|
-
+
Creates a template for the guild.
You must have the :attr:`~Permissions.manage_guild` permission to
@@ -1588,14 +1588,14 @@ class Guild(Hashable):
The description of the template.
"""
from .template import Template
-
+
payload = {
'name': name
}
if description:
payload['description'] = description
-
+
data = await self._state.http.create_template(self.id, payload)
return Template(state=self._state, data=data)
@@ -2223,6 +2223,9 @@ class Guild(Hashable):
if user_ids is not None and query is not None:
raise ValueError('Cannot pass both query and user_ids')
+ if user_ids is not None and not user_ids:
+ raise ValueError('user_ids must contain at least 1 value')
+
limit = min(100, limit or 5)
return await self._state.query_members(self, query=query, limit=limit, user_ids=user_ids, presences=presences, cache=cache)