Skip to content

Commit 911171b

Browse files
authored
feat(interactions): add attachment_size_limit (DisnakeDev#1319)
1 parent d28fe47 commit 911171b

File tree

6 files changed

+37
-0
lines changed

6 files changed

+37
-0
lines changed

changelog/1319.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add :attr:`Interaction.attachment_size_limit`.

disnake/interactions/application_command.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ class ApplicationCommandInteraction(Interaction[ClientT]):
127127
128128
.. versionadded:: 2.10
129129
130+
attachment_size_limit: :class:`int`
131+
The maximum number of bytes files can have in responses to this interaction.
132+
133+
This may be higher than the default limit, depending on the guild's boost
134+
status or the invoking user's nitro status.
135+
136+
.. versionadded:: 2.11
137+
130138
data: :class:`ApplicationCommandInteractionData`
131139
The wrapped interaction data.
132140
application_command: :class:`.InvokableApplicationCommand`

disnake/interactions/base.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,14 @@ class Interaction(Generic[ClientT]):
184184
context, you can use ``if interaction.context.guild:``.
185185
186186
.. versionadded:: 2.10
187+
188+
attachment_size_limit: :class:`int`
189+
The maximum number of bytes files can have in responses to this interaction.
190+
191+
This may be higher than the default limit, depending on the guild's boost
192+
status or the invoking user's nitro status.
193+
194+
.. versionadded:: 2.11
187195
"""
188196

189197
__slots__: Tuple[str, ...] = (
@@ -202,6 +210,7 @@ class Interaction(Generic[ClientT]):
202210
"entitlements",
203211
"authorizing_integration_owners",
204212
"context",
213+
"attachment_size_limit",
205214
"_app_permissions",
206215
"_permissions",
207216
"_state",
@@ -276,6 +285,8 @@ def __init__(self, *, data: InteractionPayload, state: ConnectionState) -> None:
276285
[context] if (context := data.get("context")) is not None else []
277286
)
278287

288+
self.attachment_size_limit: int = data["attachment_size_limit"]
289+
279290
@property
280291
def bot(self) -> ClientT:
281292
""":class:`~disnake.ext.commands.Bot`: An alias for :attr:`.client`."""

disnake/interactions/message.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ class MessageInteraction(Interaction[ClientT]):
114114
115115
.. versionadded:: 2.10
116116
117+
attachment_size_limit: :class:`int`
118+
The maximum number of bytes files can have in responses to this interaction.
119+
120+
This may be higher than the default limit, depending on the guild's boost
121+
status or the invoking user's nitro status.
122+
123+
.. versionadded:: 2.11
124+
117125
data: :class:`MessageInteractionData`
118126
The wrapped interaction data.
119127
message: Optional[:class:`Message`]

disnake/interactions/modal.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ class ModalInteraction(Interaction[ClientT]):
102102
103103
.. versionadded:: 2.10
104104
105+
attachment_size_limit: :class:`int`
106+
The maximum number of bytes files can have in responses to this interaction.
107+
108+
This may be higher than the default limit, depending on the guild's boost
109+
status or the invoking user's nitro status.
110+
111+
.. versionadded:: 2.11
112+
105113
data: :class:`ModalInteractionData`
106114
The wrapped interaction data.
107115
message: Optional[:class:`Message`]

disnake/types/interactions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ class _BaseInteraction(TypedDict):
267267
token: str
268268
version: Literal[1]
269269
app_permissions: str
270+
attachment_size_limit: int
270271

271272

272273
# common properties in non-ping interactions

0 commit comments

Comments
 (0)