diff --git a/interactions/api/models/channel.py b/interactions/api/models/channel.py index 4374609a6..df348cf56 100644 --- a/interactions/api/models/channel.py +++ b/interactions/api/models/channel.py @@ -4,6 +4,8 @@ from .misc import MISSING, DictSerializerMixin, Overwrite, Snowflake +# from ... import Presence, Member + class ChannelType(IntEnum): """An enumerable object representing the type of channels.""" @@ -19,6 +21,7 @@ class ChannelType(IntEnum): GUILD_PUBLIC_THREAD = 11 GUILD_PRIVATE_THREAD = 12 GUILD_STAGE_VOICE = 13 + FORUM = 15 class ThreadMetadata(DictSerializerMixin): @@ -79,6 +82,8 @@ class ThreadMember(DictSerializerMixin): "team_id", "membership_state", "permissions", + "member", + "presence", ) def __init__(self, **kwargs): @@ -90,6 +95,11 @@ def __init__(self, **kwargs): if self._json.get("join_timestamp") else None ) + # Take these conversions with a grain of salt. + + # Commented out for circular import reasons, but schema says they do work. + # self.member = Member(**self._json.get("member")) if self._json.get("member") else None + # self.presence = Presence(**self._json.get("presence")) if self._json.get("presence") else None class Channel(DictSerializerMixin): @@ -1040,6 +1050,45 @@ class Thread(Channel): .. note:: This is a derivation of the base Channel, since a thread can be its own event. + + Also note that forums are also dispatched as Thread + objects. """ + __slots__ = ( + "_json", + "id", + "type", + "guild_id", + "position", + "permission_overwrites", + "name", + "topic", + "nsfw", + "last_message_id", + "bitrate", + "user_limit", + "rate_limit_per_user", + "recipients", + "icon", + "owner_id", + "application_id", + "parent_id", + "last_pin_timestamp", + "rtc_region", + "video_quality_mode", + "message_count", + "member_count", + "thread_metadata", + "member", + "default_auto_archive_duration", + "permissions", + "_client", + # TODO: Document these when Discord officially documents them. + "banner", + "guild_hashes", + "flags", # This seems to be forum unique. + "newly_created", + ) + ... diff --git a/interactions/api/models/channel.pyi b/interactions/api/models/channel.pyi index 03f2c9f66..abbffacfb 100644 --- a/interactions/api/models/channel.pyi +++ b/interactions/api/models/channel.pyi @@ -4,6 +4,7 @@ from typing import List, Optional, Union, Callable from .guild import Invite, InviteTargetType from .message import Message, Embed, MessageInteraction +# from ... import Member, Presence from ...models.component import ActionRow, Button, SelectMenu from .misc import DictSerializerMixin, Overwrite, Snowflake, MISSING from .user import User @@ -21,6 +22,7 @@ class ChannelType(IntEnum): GUILD_PUBLIC_THREAD: int GUILD_PRIVATE_THREAD: int GUILD_STAGE_VOICE: int + FORUM: int class ThreadMetadata(DictSerializerMixin): _json: dict @@ -37,6 +39,8 @@ class ThreadMember(DictSerializerMixin): user_id: Optional[Snowflake] join_timestamp: datetime.timestamp flags: int + # member: Optional[Member] + # presence: Optional[Presence] def __init__(self, **kwargs): ... class Channel(DictSerializerMixin): diff --git a/interactions/api/models/gw.py b/interactions/api/models/gw.py index 9b64e3519..46a3a1497 100644 --- a/interactions/api/models/gw.py +++ b/interactions/api/models/gw.py @@ -153,14 +153,17 @@ class GuildJoinRequest(DictSerializerMixin): :ivar Snowflake user_id: The user ID of the event. :ivar Snowflake guild_id: The guild ID of the event. + :ivar Optional[Any] request: The actual request representing the event. This pertains to _CREATE, and maybe _UPDATE events. + :ivar Optional[str] status: The status of the event. This pertains to _CREATE events. """ - __slots__ = ("_json", "user_id", "guild_id") + __slots__ = ("_json", "user_id", "guild_id", "request", "status") def __init__(self, **kwargs): super().__init__(**kwargs) self.user_id = Snowflake(self.user_id) if self._json.get("user_id") else None self.guild_id = Snowflake(self.guild_id) if self._json.get("guild_id") else None + # TODO: Add model conversions for request. class GuildMember(DictSerializerMixin): @@ -801,6 +804,10 @@ def __init__(self, **kwargs): self.emoji = Emoji(**self.emoji) if self._json.get("emoji") else None +# TODO: (temp) Add Thread object for a THREAD_UPDATE event. +# More prevalent on forums for some odd reason. + + class ThreadList(DictSerializerMixin): """ A class object representing the gateway event ``THREAD_LIST_SYNC``. diff --git a/interactions/api/models/gw.pyi b/interactions/api/models/gw.pyi index 085f8f921..5472d2c47 100644 --- a/interactions/api/models/gw.pyi +++ b/interactions/api/models/gw.pyi @@ -61,6 +61,8 @@ class GuildJoinRequest(DictSerializerMixin): _json: dict user_id: Snowflake guild_id: Snowflake + request: Optional[Any] + status: Optional[str] def __init__(self, **kwargs): ... class GuildMember(DictSerializerMixin): diff --git a/interactions/api/models/message.py b/interactions/api/models/message.py index f7be081b2..72bb9cf34 100644 --- a/interactions/api/models/message.py +++ b/interactions/api/models/message.py @@ -35,6 +35,7 @@ class MessageType(IntEnum): THREAD_STARTER_MESSAGE = 21 GUILD_INVITE_REMINDER = 22 CONTEXT_MENU_COMMAND = 23 + AUTO_MODERATION_ACTION = 24 class MessageActivity(DictSerializerMixin): diff --git a/interactions/api/models/role.py b/interactions/api/models/role.py index 6fbe1dac7..050ff3e97 100644 --- a/interactions/api/models/role.py +++ b/interactions/api/models/role.py @@ -10,11 +10,20 @@ class RoleTags(DictSerializerMixin): :ivar Optional[Snowflake] bot_id?: The id of the bot this role belongs to :ivar Optional[Snowflake] integration_id?: The id of the integration this role belongs to :ivar Optional[Any] premium_subscriber?: Whether if this is the guild's premium subscriber role + :ivar Optional[Snowflake] subscription_listing_id?: The id of the linked premium membership role, if any. """ - __slots__ = ("_json", "id", "bot_id", "integration_id", "premium_subscriber") + __slots__ = ( + "_json", + "id", + "bot_id", + "integration_id", + "premium_subscriber", + "subscription_listing_id", + "purchasable_or_has_subscribers", + ) - # TODO: Figure out what actual type it returns, all it says is null. + # TODO: Figure out what actual type it returns by Discord. def __init__(self, **kwargs): super().__init__(**kwargs) @@ -23,6 +32,11 @@ def __init__(self, **kwargs): self.integration_id = ( Snowflake(self.integration_id) if self._json.get("integration_id") else None ) + self.subscription_listing_id = ( + Snowflake(self.subscription_listing_id) + if self._json.get("subscription_listing_id") + else None + ) class Role(DictSerializerMixin): diff --git a/interactions/api/models/role.pyi b/interactions/api/models/role.pyi index b865fc311..344f76794 100644 --- a/interactions/api/models/role.pyi +++ b/interactions/api/models/role.pyi @@ -8,6 +8,8 @@ class RoleTags(DictSerializerMixin): bot_id: Optional[Snowflake] integration_id: Optional[Snowflake] premium_subscriber: Optional[Any] + subscription_listing_id: Optional[Snowflake] + purchasable_or_has_subscribers: Optional[Any] def __init__(self, **kwargs): ... class Role(DictSerializerMixin):