|
|
@ -85,6 +85,7 @@ if TYPE_CHECKING: |
|
|
|
from .ui.view import View |
|
|
|
from .types.channel import ( |
|
|
|
TextChannel as TextChannelPayload, |
|
|
|
NewsChannel as NewsChannelPayload, |
|
|
|
VoiceChannel as VoiceChannelPayload, |
|
|
|
StageChannel as StageChannelPayload, |
|
|
|
DMChannel as DMChannelPayload, |
|
|
@ -163,7 +164,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable): |
|
|
|
'default_auto_archive_duration', |
|
|
|
) |
|
|
|
|
|
|
|
def __init__(self, *, state: ConnectionState, guild: Guild, data: TextChannelPayload): |
|
|
|
def __init__(self, *, state: ConnectionState, guild: Guild, data: Union[TextChannelPayload, NewsChannelPayload]): |
|
|
|
self._state: ConnectionState = state |
|
|
|
self.id: int = int(data['id']) |
|
|
|
self._type: Literal[0, 5] = data['type'] |
|
|
@ -181,7 +182,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable): |
|
|
|
joined = ' '.join('%s=%r' % t for t in attrs) |
|
|
|
return f'<{self.__class__.__name__} {joined}>' |
|
|
|
|
|
|
|
def _update(self, guild: Guild, data: TextChannelPayload) -> None: |
|
|
|
def _update(self, guild: Guild, data: Union[TextChannelPayload, NewsChannelPayload]) -> None: |
|
|
|
self.guild: Guild = guild |
|
|
|
self.name: str = data['name'] |
|
|
|
self.category_id: Optional[int] = utils._get_as_snowflake(data, 'parent_id') |
|
|
|