From bd1420b5f0b9856d3bb7129a0e4353d6bd570bb0 Mon Sep 17 00:00:00 2001 From: NCPlayz Date: Mon, 18 May 2020 00:39:22 +0100 Subject: Allow editing of channel types for news and text channels --- discord/abc.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'discord/abc.py') 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) -- cgit v1.2.3