Allow editing of channel types for news and text channels

This commit is contained in:
NCPlayz
2020-05-18 00:39:22 +01:00
committed by Rapptz
parent 12e31bb933
commit bd1420b5f0
3 changed files with 19 additions and 1 deletions

View File

@ -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)