1717)
1818from ...utils .missing import MISSING
1919from ..error import LibraryException
20+ from .emoji import Emoji
2021from .flags import Permissions
2122from .misc import AllowedMentions , File , IDMixin , Overwrite , Snowflake
2223from .user import User
3637 "ThreadMember" ,
3738 "ThreadMetadata" ,
3839 "AsyncHistoryIterator" ,
40+ "AsyncTypingContextManager" ,
41+ "Tags" ,
3942)
4043
4144
@@ -53,6 +56,7 @@ class ChannelType(IntEnum):
5356 PUBLIC_THREAD = 11
5457 PRIVATE_THREAD = 12
5558 GUILD_STAGE_VOICE = 13
59+ GUILD_DIRECTORY = 14
5660 GUILD_FORUM = 15
5761
5862
@@ -280,6 +284,30 @@ async def __aexit__(self, exc_type, exc_val, exc_tb):
280284 self .__task .cancel ()
281285
282286
287+ @define ()
288+ class Tags (DictSerializerMixin ):
289+ """
290+ An object denoting a tag object within a forum channel.
291+
292+ .. note::
293+ If the emoji is custom, it won't have name information.
294+
295+ :ivar str name: Name of the tag. The limit is up to 20 characters.
296+ :ivar int id: ID of the tag. Can also be 0 if manually created.
297+ :ivar bool moderated: A boolean denoting whether this tag can be removed/added by moderators with ``manage_threads`` permissions.
298+ :ivar Optional[Emoji] emoji?: The emoji to represent the tag, if any.
299+
300+ """
301+
302+ # TODO: Rename these to discord-docs
303+ name : str = field ()
304+ id : int = field ()
305+ moderated : bool = field ()
306+ emoji : Optional [Emoji ] = field (converter = Emoji , default = None )
307+
308+ # Maybe on post_attrs_init replace emoji object with one from cache for name population?
309+
310+
283311@define ()
284312class Channel (ClientSerializerMixin , IDMixin ):
285313 """
@@ -311,14 +339,20 @@ class Channel(ClientSerializerMixin, IDMixin):
311339 :ivar Optional[int] video_quality_mode?: The set quality mode for video streaming in the channel.
312340 :ivar int message_count: The amount of messages in the channel.
313341 :ivar Optional[int] member_count?: The amount of members in the channel.
342+ :ivar Optional[bool] newly_created?: Boolean representing if a thread is created.
314343 :ivar Optional[ThreadMetadata] thread_metadata?: The thread metadata of the channel.
315344 :ivar Optional[ThreadMember] member?: The member of the thread in the channel.
316345 :ivar Optional[int] default_auto_archive_duration?: The set auto-archive time for all threads to naturally follow in the channel.
317346 :ivar Optional[str] permissions?: The permissions of the channel.
318347 :ivar Optional[int] flags?: The flags of the channel.
319348 :ivar Optional[int] total_message_sent?: Number of messages ever sent in a thread.
349+ :ivar Optional[int] default_thread_slowmode_delay?: The default slowmode delay in seconds for threads, if this channel is a forum.
350+ :ivar Optional[List[Tags]] available_tags: Tags in a forum channel, if any.
351+ :ivar Optional[Emoji] default_reaction_emoji: Default reaction emoji for threads created in a forum, if any.
320352 """
321353
354+ # Template attribute isn't live/documented, this line exists as a placeholder 'TODO' of sorts
355+
322356 __slots__ = (
323357 # TODO: Document banner when Discord officially documents them.
324358 "banner" ,
@@ -351,6 +385,7 @@ class Channel(ClientSerializerMixin, IDMixin):
351385 video_quality_mode : Optional [int ] = field (default = None , repr = False )
352386 message_count : Optional [int ] = field (default = None , repr = False )
353387 member_count : Optional [int ] = field (default = None , repr = False )
388+ newly_created : Optional [int ] = field (default = None , repr = False )
354389 thread_metadata : Optional [ThreadMetadata ] = field (converter = ThreadMetadata , default = None )
355390 member : Optional [ThreadMember ] = field (
356391 converter = ThreadMember , default = None , add_client = True , repr = False
@@ -359,6 +394,9 @@ class Channel(ClientSerializerMixin, IDMixin):
359394 permissions : Optional [str ] = field (default = None , repr = False )
360395 flags : Optional [int ] = field (default = None , repr = False )
361396 total_message_sent : Optional [int ] = field (default = None , repr = False )
397+ default_thread_slowmode_delay : Optional [int ] = field (default = None , repr = False )
398+ tags : Optional [List [Tags ]] = field (converter = convert_list (Tags ), default = None , repr = False )
399+ default_reaction_emoji : Optional [Emoji ] = field (converter = Emoji , default = None )
362400
363401 def __attrs_post_init__ (self ): # sourcery skip: last-if-guard
364402 if self ._client :
@@ -1505,7 +1543,6 @@ async def get_permissions_for(self, member: "Member") -> Permissions:
15051543@define ()
15061544class Thread (Channel ):
15071545 """An object representing a thread.
1508-
15091546 .. note::
15101547 This is a derivation of the base Channel, since a
15111548 thread can be its own event.
0 commit comments