diff --git a/CHANGELOG.md b/CHANGELOG.md index 718642108d..7d76398448 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2817](https://github.com/Pycord-Development/pycord/pull/2817)) - Added role gradients support with `Role.colours` and the `RoleColours` class. ([#2818](https://github.com/Pycord-Development/pycord/pull/2818)) +- Added `Interaction.attachment_size_limit`. + ([#2854](https://github.com/Pycord-Development/pycord/pull/2854)) ### Fixed diff --git a/discord/commands/context.py b/discord/commands/context.py index e066bd32bc..01164b1189 100644 --- a/discord/commands/context.py +++ b/discord/commands/context.py @@ -268,6 +268,13 @@ def unselected_options(self) -> list[Option] | None: return self.command.options # type: ignore return None + @cached_property + def attachment_size_limit(self) -> int: + """Returns the attachment size limit associated with this context's interaction. + Shorthand for :attr:`.Interaction.attachment_size_limit`. + """ + return self.interaction.attachment_size_limit + @property @discord.utils.copy_doc(InteractionResponse.send_modal) def send_modal(self) -> Callable[..., Awaitable[Interaction]]: diff --git a/discord/interactions.py b/discord/interactions.py index 0e9084468d..888ed7658f 100644 --- a/discord/interactions.py +++ b/discord/interactions.py @@ -164,6 +164,10 @@ class Interaction: modal: Optional[:class:`Modal`] The modal that this interaction belongs to. + .. versionadded:: 2.7 + attachment_size_limit: :class:`int` + The attachment size limit. + .. versionadded:: 2.7 """ @@ -188,6 +192,7 @@ class Interaction: "command", "view", "modal", + "attachment_size_limit", "_channel_data", "_message_data", "_guild_data", @@ -243,6 +248,7 @@ def _from_data(self, data: InteractionPayload): self.command: ApplicationCommand | None = None self.view: View | None = None self.modal: Modal | None = None + self.attachment_size_limit: int = data.get("attachment_size_limit") self.message: Message | None = None self.channel = None diff --git a/discord/types/interactions.py b/discord/types/interactions.py index 37904a580a..8b41cb8844 100644 --- a/discord/types/interactions.py +++ b/discord/types/interactions.py @@ -215,6 +215,7 @@ class Interaction(TypedDict): locale: NotRequired[str] guild_locale: NotRequired[str] app_permissions: NotRequired[Permissions] + attachment_size_limit: NotRequired[int] id: Snowflake application_id: Snowflake type: InteractionType