From 271c7565fcf80d7e9f6bc46797d1a94a743d4b67 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Wed, 16 Dec 2015 19:32:08 -0500 Subject: [PATCH] Make Client.unban actually useful. --- discord/client.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/discord/client.py b/discord/client.py index b23082cf2..21fe412ea 100644 --- a/discord/client.py +++ b/discord/client.py @@ -1181,21 +1181,17 @@ class Client: yield from response.release() @asyncio.coroutine - def unban(self, member): + def unban(self, server, user): """|coro| - Unbans a :class:`Member` from the server they belong to. - - Warning - -------- - This function unbans the :class:`Member` based on the server it - belongs to, which is accessed via :attr:`Member.server`. So you - must have the proper permissions in that server. + Unbans a :class:`User` from the server they are banned from. Parameters ----------- - member : :class:`Member` - The member to unban from their server. + server : :class:`Server` + The server to unban the user from. + user : :class:`User` + The user to unban. Raises ------- @@ -1205,7 +1201,7 @@ class Client: Unbanning failed. """ - url = '{0}/{1.server.id}/bans/{1.id}'.format(endpoints.SERVERS, member) + url = '{0}/{1.id}/bans/{2.id}'.format(endpoints.SERVERS, server, user) response = yield from aiohttp.delete(url, headers=self.headers, loop=self.loop) log.debug(request_logging_format.format(method='DELETE', response=response)) yield from utils._verify_successful_response(response)