Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions interactions/api/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def lookup(code: int) -> str:
30047: "Maximum number of pinned threads in a forum channel has been reached",
30048: "Maximum number of tags in a forum channel has been reached",
30052: "Bitrate is too high for channel of this type",
30056: "Maximum number of premium emojis reached (25)",
31001: "Undocumented error/rate-limit related.",
40001: "Unauthorized. Provide a valid token and try again",
40002: "You need to verify your account in order to perform this action",
Expand Down Expand Up @@ -267,6 +268,8 @@ def lookup(code: int) -> str:
50109: "The request body contains invalid JSON.",
50132: "Ownership cannot be transferred to a bot user",
50138: "Failed to resize asset below the maximum size: 262144",
50144: "Cannot mix subscription and non subscription roles for an emoji",
50145: "Cannot convert between premium emoji and normal emoji",
50146: "Uploaded file not found.",
50600: "You do not have permission to send this sticker.",
60003: "Two factor is required for this operation",
Expand Down
8 changes: 8 additions & 0 deletions interactions/api/models/audit_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class AuditLogEvents(IntEnum):
"""
A class object representing the different types of AuditLogEvents.

.. note::
There is no official name for AuditLogEvents type 151, however it does represent the server owner sets up the guild for monetization/server subscriptions.

:ivar int GUILD_UPDATE: 1 - Server settings were updated
:ivar int CHANNEL_CREATE: 10 - Channel was created
:ivar int CHANNEL_UPDATE: 11 - Channel settings were updated
Expand Down Expand Up @@ -83,6 +86,7 @@ class AuditLogEvents(IntEnum):
:ivar int AUTO_MODERATION_BLOCK_MESSAGE: 143 - Message was blocked by AutoMod (according to a rule)
:ivar int AUTO_MODERATION_FLAG_TO_CHANNEL: 144 - Message was flagged by AutoMod (according to a rule)
:ivar int AUTO_MODERATION_USER_COMMUNICATION_DISABLED: 145 - Member was timed out by AutoMod (according to a rule)
:ivar int GUILD_MONETIZATION_SETUP: 151 - Monetization was set up in the server.
"""

# guild related
Expand Down Expand Up @@ -169,6 +173,10 @@ class AuditLogEvents(IntEnum):
AUTO_MODERATION_FLAG_TO_CHANNEL = 144
AUTO_MODERATION_USER_COMMUNICATION_DISABLED = 145

# monetization related

GUILD_MONETIZATION_SETUP = 151


@define()
class AuditLogChange(DictSerializerMixin):
Expand Down
2 changes: 2 additions & 0 deletions interactions/api/models/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ class GuildFeatures(Enum):
PREVIEW_ENABLED = "PREVIEW_ENABLED"
PRIVATE_THREADS = "PRIVATE_THREADS"
ROLE_ICONS = "ROLE_ICONS"
ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE = "ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE"
ROLE_SUBSCRIPTIONS_ENABLED = "ROLE_SUBSCRIPTIONS_ENABLED"
TICKETED_EVENTS_ENABLED = "TICKETED_EVENTS_ENABLED"
VANITY_URL = "VANITY_URL"
VERIFIED = "VERIFIED"
Expand Down
4 changes: 4 additions & 0 deletions interactions/api/models/gw.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,14 @@ 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 primarily to _CREATE, but maybe _UPDATE as well.
:ivar Optional[str] status: The status of the event, which pertains to _CREATE.
"""

user_id: Snowflake = field(converter=Snowflake)
guild_id: Snowflake = field(converter=Snowflake)
request: Optional[Any] = field(default=None)
status: Optional[str] = field(default=None)


@define()
Expand Down
8 changes: 7 additions & 1 deletion interactions/api/models/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@


class MessageType(IntEnum):
"""An enumerable object representing the types of messages."""
"""
An enumerable object representing the types of messages.

.. note::
There is no official name for MessageType 25, however it does represent when someone subscribes to a server for the first time.
"""

DEFAULT = 0
RECIPIENT_ADD = 1
Expand All @@ -75,6 +80,7 @@ class MessageType(IntEnum):
GUILD_INVITE_REMINDER = 22
CONTEXT_MENU_COMMAND = 23
AUTO_MODERATION_ACTION = 24
ROLE_SUBSCRIPTION_PURCHASE = 25

@staticmethod
def not_deletable() -> List[int]:
Expand Down
16 changes: 12 additions & 4 deletions interactions/api/models/role.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Any, List, Optional, Union
from typing import TYPE_CHECKING, List, Optional, Union

from ...utils.attrs_utils import ClientSerializerMixin, DictSerializerMixin, define, field
from ...utils.missing import MISSING
Expand All @@ -19,16 +19,24 @@ class RoleTags(DictSerializerMixin):
"""
A class object representing the tags of a role.

.. note ::
With the premium_subscriber and available_for_purchase attributes currently,
if the attribute is present and "null" it's true, and if the attribute is not present it's false.


: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[bool] premium_subscriber: Whether if this is the guild's booster role.
:ivar Optional[Snowflake] subscription_listing_id: The id of this role's subscription sku and listing, if any.
:ivar Optional[bool] available_for_purchase: Whether this role is available for purchase.
"""

bot_id: Optional[Snowflake] = field(converter=Snowflake, default=None)
integration_id: Optional[Snowflake] = field(converter=Snowflake, default=None)
premium_subscriber: Optional[Any] = field(default=None)
premium_subscriber: Optional[bool] = field(default=None)

# TODO: Figure out what actual type it returns, all it says is null.
subscription_listing_id: Optional[Snowflake] = field(converter=Snowflake, default=None)
purchasable_or_has_subscribers: Optional[bool] = field(default=None)


@define()
Expand Down