diff options
| author | NCPlayz <[email protected]> | 2020-05-18 00:39:22 +0100 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-05-29 23:21:59 -0400 |
| commit | bd1420b5f0b9856d3bb7129a0e4353d6bd570bb0 (patch) | |
| tree | 181c0a1210a9a7cddf2286c28fce1889a6578070 /discord/abc.py | |
| parent | Fix KeyError on Member Channels not in JSON (diff) | |
| download | discord.py-bd1420b5f0b9856d3bb7129a0e4353d6bd570bb0.tar.xz discord.py-bd1420b5f0b9856d3bb7129a0e4353d6bd570bb0.zip | |
Allow editing of channel types for news and text channels
Diffstat (limited to 'discord/abc.py')
| -rw-r--r-- | discord/abc.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/discord/abc.py b/discord/abc.py index 7e1bc122..07046a40 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -31,6 +31,7 @@ from collections import namedtuple from .iterators import HistoryIterator from .context_managers import Typing +from .enums import ChannelType from .errors import InvalidArgument, ClientException, HTTPException from .permissions import PermissionOverwrite, Permissions from .role import Role @@ -280,6 +281,15 @@ class GuildChannel: perms.append(payload) options['permission_overwrites'] = perms + try: + ch_type = options['type'] + except KeyError: + pass + else: + if not isinstance(ch_type, ChannelType): + raise InvalidArgument('type field must be of type ChannelType') + options['type'] = ch_type.value + if options: data = await self._state.http.edit_channel(self.id, reason=reason, **options) self._update(self.guild, data) |