Browse Source

Make Client.unban actually useful.

pull/60/head
Rapptz 9 years ago
parent
commit
271c7565fc
  1. 18
      discord/client.py

18
discord/client.py

@ -1181,21 +1181,17 @@ class Client:
yield from response.release() yield from response.release()
@asyncio.coroutine @asyncio.coroutine
def unban(self, member): def unban(self, server, user):
"""|coro| """|coro|
Unbans a :class:`Member` from the server they belong to. Unbans a :class:`User` from the server they are banned from.
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.
Parameters Parameters
----------- -----------
member : :class:`Member` server : :class:`Server`
The member to unban from their server. The server to unban the user from.
user : :class:`User`
The user to unban.
Raises Raises
------- -------
@ -1205,7 +1201,7 @@ class Client:
Unbanning failed. 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) response = yield from aiohttp.delete(url, headers=self.headers, loop=self.loop)
log.debug(request_logging_format.format(method='DELETE', response=response)) log.debug(request_logging_format.format(method='DELETE', response=response))
yield from utils._verify_successful_response(response) yield from utils._verify_successful_response(response)

Loading…
Cancel
Save