Allow editing of channel types for news and text channels
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user