diff options
| author | Rapptz <[email protected]> | 2016-12-31 00:27:12 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-01-03 09:52:08 -0500 |
| commit | 633eacc98241c0bf0ba60e1e9151f6c0719e9bf3 (patch) | |
| tree | fd56024392ae504a1a5d85c2feb3c250d3b49fef /discord/client.py | |
| parent | Move GuildChannel over to abc module. (diff) | |
| download | discord.py-633eacc98241c0bf0ba60e1e9151f6c0719e9bf3.tar.xz discord.py-633eacc98241c0bf0ba60e1e9151f6c0719e9bf3.zip | |
Add permission overwrites to GuildChannel.
Diffstat (limited to 'discord/client.py')
| -rw-r--r-- | discord/client.py | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/discord/client.py b/discord/client.py index 6c61ce99..55dc0f2e 100644 --- a/discord/client.py +++ b/discord/client.py @@ -1180,96 +1180,6 @@ class Client: invite_id = self._resolve_invite(invite) yield from self.http.delete_invite(invite_id) - @asyncio.coroutine - def edit_channel_permissions(self, channel, target, overwrite=None): - """|coro| - - Sets the channel specific permission overwrites for a target in the - specified :class:`Channel`. - - The ``target`` parameter should either be a :class:`Member` or a - :class:`Role` that belongs to the channel's guild. - - You must have the proper permissions to do this. - - Examples - ---------- - - Setting allow and deny: :: - - overwrite = discord.PermissionOverwrite() - overwrite.read_messages = True - overwrite.ban_members = False - yield from client.edit_channel_permissions(message.channel, message.author, overwrite) - - Parameters - ----------- - channel : :class:`Channel` - The channel to give the specific permissions for. - target - The :class:`Member` or :class:`Role` to overwrite permissions for. - overwrite: :class:`PermissionOverwrite` - The permissions to allow and deny to the target. - - Raises - ------- - Forbidden - You do not have permissions to edit channel specific permissions. - NotFound - The channel specified was not found. - HTTPException - Editing channel specific permissions failed. - InvalidArgument - The overwrite parameter was not of type :class:`PermissionOverwrite` - or the target type was not :class:`Role` or :class:`Member`. - """ - - overwrite = PermissionOverwrite() if overwrite is None else overwrite - - - if not isinstance(overwrite, PermissionOverwrite): - raise InvalidArgument('allow and deny parameters must be PermissionOverwrite') - - allow, deny = overwrite.pair() - - if isinstance(target, Member): - perm_type = 'member' - elif isinstance(target, Role): - perm_type = 'role' - else: - raise InvalidArgument('target parameter must be either Member or Role') - - yield from self.http.edit_channel_permissions(channel.id, target.id, allow.value, deny.value, perm_type) - - @asyncio.coroutine - def delete_channel_permissions(self, channel, target): - """|coro| - - Removes a channel specific permission overwrites for a target - in the specified :class:`Channel`. - - The target parameter follows the same rules as :meth:`edit_channel_permissions`. - - You must have the proper permissions to do this. - - Parameters - ---------- - channel : :class:`Channel` - The channel to give the specific permissions for. - target - The :class:`Member` or :class:`Role` to overwrite permissions for. - - Raises - ------ - Forbidden - You do not have permissions to delete channel specific permissions. - NotFound - The channel specified was not found. - HTTPException - Deleting channel specific permissions failed. - """ - yield from self.http.delete_channel_permissions(channel.id, target.id) - # Miscellaneous stuff @asyncio.coroutine |