Skip to content

Commit ef06d7d

Browse files
authored
Add Interaction.filesize_limit
1 parent e177b4a commit ef06d7d

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

discord/interactions.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ class Interaction(Generic[ClientT]):
154154
The context of the interaction.
155155
156156
.. versionadded:: 2.4
157+
filesize_limit: int
158+
The maximum number of bytes a file can have when responding to this interaction.
159+
160+
.. versionadded:: 2.6
157161
"""
158162

159163
__slots__: Tuple[str, ...] = (
@@ -172,7 +176,8 @@ class Interaction(Generic[ClientT]):
172176
'command_failed',
173177
'entitlement_sku_ids',
174178
'entitlements',
175-
"context",
179+
'context',
180+
'filesize_limit',
176181
'_integration_owners',
177182
'_permissions',
178183
'_app_permissions',
@@ -214,6 +219,7 @@ def _from_data(self, data: InteractionPayload):
214219
self.application_id: int = int(data['application_id'])
215220
self.entitlement_sku_ids: List[int] = [int(x) for x in data.get('entitlement_skus', []) or []]
216221
self.entitlements: List[Entitlement] = [Entitlement(self._state, x) for x in data.get('entitlements', [])]
222+
self.filesize_limit: int = data['attachment_size_limit']
217223
# This is not entirely useful currently, unsure how to expose it in a way that it is.
218224
self._integration_owners: Dict[int, Snowflake] = {
219225
int(k): int(v) for k, v in data.get('authorizing_integration_owners', {}).items()

discord/types/interactions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ class _BaseInteraction(TypedDict):
233233
entitlements: NotRequired[List[Entitlement]]
234234
authorizing_integration_owners: Dict[Literal['0', '1'], Snowflake]
235235
context: NotRequired[InteractionContextType]
236+
attachment_size_limit: int
236237

237238

238239
class PingInteraction(_BaseInteraction):

tests/test_app_commands_invoke.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2222
DEALINGS IN THE SOFTWARE.
2323
"""
24+
2425
from __future__ import annotations
2526

2627

@@ -90,6 +91,7 @@ def __init__(
9091
"version": 1,
9192
"type": 2,
9293
"data": self._get_command_data(command, self._get_command_options(**options)),
94+
"attachment_size_limit": 0,
9395
}
9496
super().__init__(data=data, state=client._connection)
9597

0 commit comments

Comments
 (0)