17
17
)
18
18
from ...utils .missing import MISSING
19
19
from ..error import LibraryException
20
+ from .emoji import Emoji
20
21
from .flags import Permissions
21
22
from .misc import AllowedMentions , File , IDMixin , Overwrite , Snowflake
22
23
from .user import User
36
37
"ThreadMember" ,
37
38
"ThreadMetadata" ,
38
39
"AsyncHistoryIterator" ,
40
+ "AsyncTypingContextManager" ,
41
+ "Tags" ,
39
42
)
40
43
41
44
@@ -53,6 +56,7 @@ class ChannelType(IntEnum):
53
56
PUBLIC_THREAD = 11
54
57
PRIVATE_THREAD = 12
55
58
GUILD_STAGE_VOICE = 13
59
+ GUILD_DIRECTORY = 14
56
60
GUILD_FORUM = 15
57
61
58
62
@@ -280,6 +284,30 @@ async def __aexit__(self, exc_type, exc_val, exc_tb):
280
284
self .__task .cancel ()
281
285
282
286
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
+
283
311
@define ()
284
312
class Channel (ClientSerializerMixin , IDMixin ):
285
313
"""
@@ -311,14 +339,20 @@ class Channel(ClientSerializerMixin, IDMixin):
311
339
:ivar Optional[int] video_quality_mode?: The set quality mode for video streaming in the channel.
312
340
:ivar int message_count: The amount of messages in the channel.
313
341
: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.
314
343
:ivar Optional[ThreadMetadata] thread_metadata?: The thread metadata of the channel.
315
344
:ivar Optional[ThreadMember] member?: The member of the thread in the channel.
316
345
:ivar Optional[int] default_auto_archive_duration?: The set auto-archive time for all threads to naturally follow in the channel.
317
346
:ivar Optional[str] permissions?: The permissions of the channel.
318
347
:ivar Optional[int] flags?: The flags of the channel.
319
348
: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.
320
352
"""
321
353
354
+ # Template attribute isn't live/documented, this line exists as a placeholder 'TODO' of sorts
355
+
322
356
__slots__ = (
323
357
# TODO: Document banner when Discord officially documents them.
324
358
"banner" ,
@@ -351,6 +385,7 @@ class Channel(ClientSerializerMixin, IDMixin):
351
385
video_quality_mode : Optional [int ] = field (default = None , repr = False )
352
386
message_count : Optional [int ] = field (default = None , repr = False )
353
387
member_count : Optional [int ] = field (default = None , repr = False )
388
+ newly_created : Optional [int ] = field (default = None , repr = False )
354
389
thread_metadata : Optional [ThreadMetadata ] = field (converter = ThreadMetadata , default = None )
355
390
member : Optional [ThreadMember ] = field (
356
391
converter = ThreadMember , default = None , add_client = True , repr = False
@@ -359,6 +394,9 @@ class Channel(ClientSerializerMixin, IDMixin):
359
394
permissions : Optional [str ] = field (default = None , repr = False )
360
395
flags : Optional [int ] = field (default = None , repr = False )
361
396
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 )
362
400
363
401
def __attrs_post_init__ (self ): # sourcery skip: last-if-guard
364
402
if self ._client :
@@ -1505,7 +1543,6 @@ async def get_permissions_for(self, member: "Member") -> Permissions:
1505
1543
@define ()
1506
1544
class Thread (Channel ):
1507
1545
"""An object representing a thread.
1508
-
1509
1546
.. note::
1510
1547
This is a derivation of the base Channel, since a
1511
1548
thread can be its own event.
0 commit comments