Skip to content

Commit b43969a

Browse files
hich4tPaillat-devLulalaby
authored
feat: added Interaction.attachment_size_limit (#2854)
Signed-off-by: hich4t <[email protected]> Co-authored-by: Paillat <[email protected]> Co-authored-by: Lala Sabathil <[email protected]>
1 parent 2962873 commit b43969a

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
@@ -268,6 +268,13 @@ def unselected_options(self) -> list[Option] | None:
268268
return self.command.options # type: ignore
269269
return None
270270

271+
@cached_property
272+
def attachment_size_limit(self) -> int:
273+
"""Returns the attachment size limit associated with this context's interaction.
274+
Shorthand for :attr:`.Interaction.attachment_size_limit`.
275+
"""
276+
return self.interaction.attachment_size_limit
277+
271278
@property
272279
@discord.utils.copy_doc(InteractionResponse.send_modal)
273280
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",
@@ -243,6 +248,7 @@ def _from_data(self, data: InteractionPayload):
243248
self.command: ApplicationCommand | None = None
244249
self.view: View | None = None
245250
self.modal: Modal | None = None
251+
self.attachment_size_limit: int = data.get("attachment_size_limit")
246252

247253
self.message: Message | None = None
248254
self.channel = None

discord/types/interactions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ class Interaction(TypedDict):
215215
locale: NotRequired[str]
216216
guild_locale: NotRequired[str]
217217
app_permissions: NotRequired[Permissions]
218+
attachment_size_limit: NotRequired[int]
218219
id: Snowflake
219220
application_id: Snowflake
220221
type: InteractionType

0 commit comments

Comments
 (0)