mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
parent
7a1102ccf0
commit
519f0c07ea
@ -1021,8 +1021,8 @@ class Guild(Hashable):
|
||||
reason=e['reason'])
|
||||
for e in data]
|
||||
|
||||
async def prune_members(self, *, days, reason=None):
|
||||
"""|coro|
|
||||
async def prune_members(self, *, days, compute_prune_count=True, reason=None):
|
||||
r"""|coro|
|
||||
|
||||
Prunes the guild from its inactive members.
|
||||
|
||||
@ -1041,6 +1041,11 @@ class Guild(Hashable):
|
||||
The number of days before counting as inactive.
|
||||
reason: Optional[:class:`str`]
|
||||
The reason for doing this action. Shows up on the audit log.
|
||||
compute_prune_count: :class:`bool`
|
||||
Whether to compute the prune count. This defaults to ``True``
|
||||
which makes it prone to timeouts in very large guilds. In order
|
||||
to prevent timeouts, you must set this to ``False``. If this is
|
||||
set to ``False``\, then this function will always return ``None``.
|
||||
|
||||
Raises
|
||||
-------
|
||||
@ -1053,14 +1058,15 @@ class Guild(Hashable):
|
||||
|
||||
Returns
|
||||
---------
|
||||
:class:`int`
|
||||
The number of members pruned.
|
||||
Optional[:class:`int`]
|
||||
The number of members pruned. If ``compute_prune_count`` is ``False``
|
||||
then this returns ``None``.
|
||||
"""
|
||||
|
||||
if not isinstance(days, int):
|
||||
raise InvalidArgument('Expected int for ``days``, received {0.__class__.__name__} instead.'.format(days))
|
||||
|
||||
data = await self._state.http.prune_members(self.id, days, reason=reason)
|
||||
data = await self._state.http.prune_members(self.id, days, compute_prune_count=compute_prune_count, reason=reason)
|
||||
return data['pruned']
|
||||
|
||||
async def webhooks(self):
|
||||
|
@ -615,9 +615,10 @@ class HTTPClient:
|
||||
def get_member(self, guild_id, member_id):
|
||||
return self.request(Route('GET', '/guilds/{guild_id}/members/{member_id}', guild_id=guild_id, member_id=member_id))
|
||||
|
||||
def prune_members(self, guild_id, days, *, reason=None):
|
||||
def prune_members(self, guild_id, days, compute_prune_count, *, reason=None):
|
||||
params = {
|
||||
'days': days
|
||||
'days': days,
|
||||
'compute_prune_count': compute_prune_count
|
||||
}
|
||||
return self.request(Route('POST', '/guilds/{guild_id}/prune', guild_id=guild_id), params=params, reason=reason)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user