Disallow empty sequences in Guild.query_members user_id parameter
This commit is contained in:
parent
a2730a32dc
commit
4c4d75dc29
@ -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)
|
data = await self._state.http.prune_members(self.id, days, compute_prune_count=compute_prune_count, roles=roles, reason=reason)
|
||||||
return data['pruned']
|
return data['pruned']
|
||||||
|
|
||||||
async def templates(self):
|
async def templates(self):
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
Gets the list of templates from this guild.
|
Gets the list of templates from this guild.
|
||||||
|
|
||||||
Requires :attr:`~.Permissions.manage_guild` permissions.
|
Requires :attr:`~.Permissions.manage_guild` permissions.
|
||||||
@ -1474,7 +1474,7 @@ class Guild(Hashable):
|
|||||||
-------
|
-------
|
||||||
Forbidden
|
Forbidden
|
||||||
You don't have permissions to get the templates.
|
You don't have permissions to get the templates.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
--------
|
--------
|
||||||
List[:class:`Template`]
|
List[:class:`Template`]
|
||||||
@ -1569,10 +1569,10 @@ class Guild(Hashable):
|
|||||||
result.append(Invite(state=self._state, data=invite))
|
result.append(Invite(state=self._state, data=invite))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
async def create_template(self, *, name, description=None):
|
async def create_template(self, *, name, description=None):
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
Creates a template for the guild.
|
Creates a template for the guild.
|
||||||
|
|
||||||
You must have the :attr:`~Permissions.manage_guild` permission to
|
You must have the :attr:`~Permissions.manage_guild` permission to
|
||||||
@ -1588,14 +1588,14 @@ class Guild(Hashable):
|
|||||||
The description of the template.
|
The description of the template.
|
||||||
"""
|
"""
|
||||||
from .template import Template
|
from .template import Template
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
'name': name
|
'name': name
|
||||||
}
|
}
|
||||||
|
|
||||||
if description:
|
if description:
|
||||||
payload['description'] = description
|
payload['description'] = description
|
||||||
|
|
||||||
data = await self._state.http.create_template(self.id, payload)
|
data = await self._state.http.create_template(self.id, payload)
|
||||||
|
|
||||||
return Template(state=self._state, data=data)
|
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:
|
if user_ids is not None and query is not None:
|
||||||
raise ValueError('Cannot pass both query and user_ids')
|
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)
|
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)
|
return await self._state.query_members(self, query=query, limit=limit, user_ids=user_ids, presences=presences, cache=cache)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user