Skip to content

Commit d9eda95

Browse files
hich4tPaillat-devLulalaby
committed
feat: added Interaction.attachment_size_limit (Pycord-Development#2854)
Signed-off-by: hich4t <[email protected]> Co-authored-by: Paillat <[email protected]> Co-authored-by: Lala Sabathil <[email protected]> (cherry picked from commit b43969a)
1 parent 0c6a48e commit d9eda95

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ These changes are available on the `master` branch, but have not yet been releas
6767
([#2817](https://github.com/Pycord-Development/pycord/pull/2817))
6868
- Added role gradients support with `Role.colours` and the `RoleColours` class.
6969
([#2818](https://github.com/Pycord-Development/pycord/pull/2818))
70+
- Added `Interaction.attachment_size_limit`.
71+
([#2854](https://github.com/Pycord-Development/pycord/pull/2854))
7072

7173
### Fixed
7274

discord/commands/context.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,13 @@ def unselected_options(self) -> list[Option] | None:
263263
return self.command.options # type: ignore
264264
return None
265265

266+
@cached_property
267+
def attachment_size_limit(self) -> int:
268+
"""Returns the attachment size limit associated with this context's interaction.
269+
Shorthand for :attr:`.Interaction.attachment_size_limit`.
270+
"""
271+
return self.interaction.attachment_size_limit
272+
266273
@property
267274
@discord.utils.copy_doc(InteractionResponse.send_modal)
268275
def send_modal(self) -> Callable[..., Awaitable[Interaction]]:

discord/interactions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ class Interaction:
164164
modal: Optional[:class:`Modal`]
165165
The modal that this interaction belongs to.
166166
167+
.. versionadded:: 2.7
168+
attachment_size_limit: :class:`int`
169+
The attachment size limit.
170+
167171
.. versionadded:: 2.7
168172
"""
169173

@@ -188,6 +192,7 @@ class Interaction:
188192
"command",
189193
"view",
190194
"modal",
195+
"attachment_size_limit",
191196
"_channel_data",
192197
"_message_data",
193198
"_guild_data",
@@ -237,6 +242,7 @@ def _from_data(self, data: InteractionPayload):
237242
self.command: ApplicationCommand | None = None
238243
self.view: View | None = None
239244
self.modal: Modal | None = None
245+
self.attachment_size_limit: int = data.get("attachment_size_limit")
240246

241247
self.message: Message | None = None
242248
self.channel = None

discord/types/interactions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ class Interaction(TypedDict):
203203
locale: NotRequired[str]
204204
guild_locale: NotRequired[str]
205205
app_permissions: NotRequired[Permissions]
206+
attachment_size_limit: NotRequired[int]
206207
id: Snowflake
207208
application_id: Snowflake
208209
type: InteractionType

0 commit comments

Comments
 (0)