diff options
| author | Rapptz <[email protected]> | 2015-10-22 21:41:09 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2015-10-22 22:20:35 -0400 |
| commit | 6f76a5ab33717c5bfe8d4d298b1cbe3dbe5abcc3 (patch) | |
| tree | 99cebc5109f259ea0ef63d70a8bbffbebadf1b2f | |
| parent | Add Client.set_channel_permissions (diff) | |
| download | discord.py-6f76a5ab33717c5bfe8d4d298b1cbe3dbe5abcc3.tar.xz discord.py-6f76a5ab33717c5bfe8d4d298b1cbe3dbe5abcc3.zip | |
Add Client.delete_channel_permissions
Fixes #18
| -rw-r--r-- | discord/client.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/discord/client.py b/discord/client.py index 272ceee7..ecb2f132 100644 --- a/discord/client.py +++ b/discord/client.py @@ -1212,6 +1212,8 @@ class Client(object): The ``target`` parameter should either be a :class:`Member` or a :class:`Role` that belongs to the channel's server. + You must have the proper permissions to do this. + Example code: :: allow = discord.Permissions.none() @@ -1252,6 +1254,24 @@ class Client(object): log.debug(request_logging_format.format(response=response, name='set_channel_permissions')) return is_response_successful(response) + def delete_channel_permissions(self, channel, target): + """Removes a channel specific permission overwrites for a target + in the specified :class:`Channel`. + + The target parameter follows the same rules as :meth:`set_channel_permissions`. + + You must have the proper permissions to do this. + + :param channel: The :class:`Channel` to give the specific permissions for. + :param target: The :class:`Member` or :class:`Role` to overwrite permissions for. + :return: ``True`` if deletion is successful, ``False`` otherwise. + """ + + url = '{0}/{1.id}/permissions/{2.id}'.format(endpoints.CHANNELS, channel, target) + response = requests.delete(url, headers=self.headers) + log.debug(request_logging_format.format(response=response, name='delete_channel_permissions')) + return is_response_successful(response) + def change_status(self, game_id=None, idle=False): """Changes the client's status. |