Browse Source
Fix error raised when using the roles parameter.
pull/5069/head
Tarek
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
4 deletions
-
discord/guild.py
-
discord/http.py
|
|
@ -1379,7 +1379,7 @@ class Guild(Hashable): |
|
|
|
raise InvalidArgument('Expected int for ``days``, received {0.__class__.__name__} instead.'.format(days)) |
|
|
|
|
|
|
|
if roles: |
|
|
|
roles = [role.id for role in roles] |
|
|
|
roles = [str(role.id) for role in roles] |
|
|
|
|
|
|
|
data = await self._state.http.prune_members(self.id, days, compute_prune_count=compute_prune_count, roles=roles, reason=reason) |
|
|
|
return data['pruned'] |
|
|
|
|
|
@ -660,12 +660,12 @@ class HTTPClient: |
|
|
|
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, compute_prune_count, roles, *, reason=None): |
|
|
|
params = { |
|
|
|
payload = { |
|
|
|
'days': days, |
|
|
|
'compute_prune_count': 'true' if compute_prune_count else 'false', |
|
|
|
'include_roles': roles |
|
|
|
'include_roles': ', '.join(roles) |
|
|
|
} |
|
|
|
return self.request(Route('POST', '/guilds/{guild_id}/prune', guild_id=guild_id), params=params, reason=reason) |
|
|
|
return self.request(Route('POST', '/guilds/{guild_id}/prune', guild_id=guild_id), json=payload, reason=reason) |
|
|
|
|
|
|
|
def estimate_pruned_members(self, guild_id, days): |
|
|
|
params = { |
|
|
|