aboutsummaryrefslogtreecommitdiff
path: root/discord/guild.py
diff options
context:
space:
mode:
authorz03h <[email protected]>2021-03-24 05:17:34 -0700
committerGitHub <[email protected]>2021-03-24 08:17:34 -0400
commitfbb7ac6be144d9371c9a67735c80bb787d09673a (patch)
tree491d5b71735857ab6f24dbe0caead6e136194794 /discord/guild.py
parent[commands] Include group args in command signature (diff)
downloaddiscord.py-fbb7ac6be144d9371c9a67735c80bb787d09673a.tar.xz
discord.py-fbb7ac6be144d9371c9a67735c80bb787d09673a.zip
Add roles to guild.estimate_pruned_members
Diffstat (limited to 'discord/guild.py')
-rw-r--r--discord/guild.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/discord/guild.py b/discord/guild.py
index 92d9a59e..9610cdea 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -1506,7 +1506,7 @@ class Guild(Hashable):
data = await self._state.http.guild_webhooks(self.id)
return [Webhook.from_state(d, state=self._state) for d in data]
- async def estimate_pruned_members(self, *, days):
+ async def estimate_pruned_members(self, *, days, roles=None):
"""|coro|
Similar to :meth:`prune_members` except instead of actually
@@ -1517,6 +1517,11 @@ class Guild(Hashable):
-----------
days: :class:`int`
The number of days before counting as inactive.
+ roles: Optional[List[:class:`abc.Snowflake`]]
+ A list of :class:`abc.Snowflake` that represent roles to include in the estimate. If a member
+ has a role that is not specified, they'll be excluded.
+
+ .. versionadded:: 1.7
Raises
-------
@@ -1536,7 +1541,10 @@ class Guild(Hashable):
if not isinstance(days, int):
raise InvalidArgument('Expected int for ``days``, received {0.__class__.__name__} instead.'.format(days))
- data = await self._state.http.estimate_pruned_members(self.id, days)
+ if roles:
+ roles = [str(role.id) for role in roles]
+
+ data = await self._state.http.estimate_pruned_members(self.id, days, roles)
return data['pruned']
async def invites(self):