Skip to content

Commit 1e07ba1

Browse files
authored
Merge branch 'master' into get_component
Signed-off-by: UK <[email protected]>
2 parents 631f5ff + e1814cc commit 1e07ba1

File tree

18 files changed

+121
-94
lines changed

18 files changed

+121
-94
lines changed

.github/CODEOWNERS

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
* @Pycord-Development/maintainers
22

3-
/tests/ @Pycord-Development/maintain-tests @Pycord-Development/maintainers
4-
/discord/ext/testing/ @Pycord-Development/maintain-tests @Pycord-Development/maintainers
5-
/discord/ext/bridge/ @Pycord-Development/maintain-ext-bridge @Pycord-Development/maintainers
6-
/.github/ @Pycord-Development/maintainers @Lulalaby
3+
/discord/ @Pycord-Development/maintain-discord-api
4+
5+
/tests/ @Pycord-Development/maintain-tests
6+
/discord/ext/testing/ @Pycord-Development/maintain-tests
7+
/discord/ext/bridge/ @Pycord-Development/maintain-ext-bridge
8+
/.github/ @Lulalaby
79
/docs/locales/ @Pycord-Development/maintain-translations
810
/docs/build/locales/ @Pycord-Development/maintain-translations
911
/.github/workflows/docs-localization-download.yml @Pycord-Development/maintain-translations

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44

55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v5.0.0
7+
rev: v6.0.0
88
hooks:
99
- id: trailing-whitespace
1010
exclude: \.(po|pot|yml|yaml)$

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
- Added `get_component` to `Message`, `Section`, `Container` and `ActionRow`.
7173
([#2849](https://github.com/Pycord-Development/pycord/pull/2849))
7274

discord/audit_logs.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -602,12 +602,12 @@ def _get_member(self, user_id: int) -> Member | User | None:
602602
def __repr__(self) -> str:
603603
return f"<AuditLogEntry id={self.id} action={self.action} user={self.user!r}>"
604604

605-
@utils.cached_property
605+
@property
606606
def created_at(self) -> datetime.datetime:
607607
"""Returns the entry's creation time in UTC."""
608608
return utils.snowflake_time(self.id)
609609

610-
@utils.cached_property
610+
@property
611611
def target(
612612
self,
613613
) -> (
@@ -631,24 +631,24 @@ def target(
631631
else:
632632
return converter(self._target_id)
633633

634-
@utils.cached_property
634+
@property
635635
def category(self) -> enums.AuditLogActionCategory:
636636
"""The category of the action, if applicable."""
637637
return self.action.category
638638

639-
@utils.cached_property
639+
@property
640640
def changes(self) -> AuditLogChanges:
641641
"""The list of changes this entry has."""
642642
obj = AuditLogChanges(self, self._changes, state=self._state)
643643
del self._changes
644644
return obj
645645

646-
@utils.cached_property
646+
@property
647647
def before(self) -> AuditLogDiff:
648648
"""The target's prior state."""
649649
return self.changes.before
650650

651-
@utils.cached_property
651+
@property
652652
def after(self) -> AuditLogDiff:
653653
"""The target's subsequent state."""
654654
return self.changes.after

discord/automod.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,12 @@ def __repr__(self) -> str:
416416
def __str__(self) -> str:
417417
return self.name
418418

419-
@cached_property
419+
@property
420420
def guild(self) -> Guild | None:
421421
"""The guild this rule belongs to."""
422422
return self._state._get_guild(self.guild_id)
423423

424-
@cached_property
424+
@property
425425
def creator(self) -> Member | None:
426426
"""The member who created this rule."""
427427
if self.guild is None:

discord/commands/context.py

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,25 @@
3232
from discord.webhook.async_ import Webhook
3333

3434
if TYPE_CHECKING:
35+
from typing import Awaitable, Callable
36+
3537
from typing_extensions import ParamSpec
3638

3739
import discord
38-
from .. import Bot
39-
from ..state import ConnectionState
40-
from ..voice_client import VoiceClient
4140

42-
from .core import ApplicationCommand, Option
43-
from ..interactions import InteractionChannel
41+
from .. import Bot
42+
from ..client import ClientUser
43+
from ..cog import Cog
4444
from ..guild import Guild
45+
from ..interactions import InteractionChannel
4546
from ..member import Member
4647
from ..message import Message
47-
from ..user import User
4848
from ..permissions import Permissions
49-
from ..client import ClientUser
50-
51-
from ..cog import Cog
49+
from ..state import ConnectionState
50+
from ..user import User
51+
from ..voice_client import VoiceClient
5252
from ..webhook import WebhookMessage
53-
54-
from typing import Callable, Awaitable
55-
56-
from ..utils import cached_property
53+
from .core import ApplicationCommand, Option
5754

5855
T = TypeVar("T")
5956
CogT = TypeVar("CogT", bound="Cog")
@@ -142,53 +139,53 @@ def command(self) -> ApplicationCommand | None:
142139
def command(self, value: ApplicationCommand | None) -> None:
143140
self.interaction.command = value
144141

145-
@cached_property
142+
@property
146143
def channel(self) -> InteractionChannel | None:
147144
"""Union[:class:`abc.GuildChannel`, :class:`PartialMessageable`, :class:`Thread`]:
148145
Returns the channel associated with this context's command. Shorthand for :attr:`.Interaction.channel`.
149146
"""
150147
return self.interaction.channel
151148

152-
@cached_property
149+
@property
153150
def channel_id(self) -> int | None:
154151
"""Returns the ID of the channel associated with this context's command.
155152
Shorthand for :attr:`.Interaction.channel_id`.
156153
"""
157154
return self.interaction.channel_id
158155

159-
@cached_property
156+
@property
160157
def guild(self) -> Guild | None:
161158
"""Returns the guild associated with this context's command.
162159
Shorthand for :attr:`.Interaction.guild`.
163160
"""
164161
return self.interaction.guild
165162

166-
@cached_property
163+
@property
167164
def guild_id(self) -> int | None:
168165
"""Returns the ID of the guild associated with this context's command.
169166
Shorthand for :attr:`.Interaction.guild_id`.
170167
"""
171168
return self.interaction.guild_id
172169

173-
@cached_property
170+
@property
174171
def locale(self) -> str | None:
175172
"""Returns the locale of the guild associated with this context's command.
176173
Shorthand for :attr:`.Interaction.locale`.
177174
"""
178175
return self.interaction.locale
179176

180-
@cached_property
177+
@property
181178
def guild_locale(self) -> str | None:
182179
"""Returns the locale of the guild associated with this context's command.
183180
Shorthand for :attr:`.Interaction.guild_locale`.
184181
"""
185182
return self.interaction.guild_locale
186183

187-
@cached_property
184+
@property
188185
def app_permissions(self) -> Permissions:
189186
return self.interaction.app_permissions
190187

191-
@cached_property
188+
@property
192189
def me(self) -> Member | ClientUser | None:
193190
"""Union[:class:`.Member`, :class:`.ClientUser`]:
194191
Similar to :attr:`.Guild.me` except it may return the :class:`.ClientUser` in private message
@@ -200,14 +197,14 @@ def me(self) -> Member | ClientUser | None:
200197
else self.bot.user
201198
)
202199

203-
@cached_property
200+
@property
204201
def message(self) -> Message | None:
205202
"""Returns the message sent with this context's command.
206203
Shorthand for :attr:`.Interaction.message`, if applicable.
207204
"""
208205
return self.interaction.message
209206

210-
@cached_property
207+
@property
211208
def user(self) -> Member | User:
212209
"""Returns the user that sent this context's command.
213210
Shorthand for :attr:`.Interaction.user`.
@@ -226,7 +223,7 @@ def voice_client(self) -> VoiceClient | None:
226223

227224
return self.interaction.guild.voice_client
228225

229-
@cached_property
226+
@property
230227
def response(self) -> InteractionResponse:
231228
"""Returns the response object associated with this context's command.
232229
Shorthand for :attr:`.Interaction.response`.
@@ -268,6 +265,13 @@ def unselected_options(self) -> list[Option] | None:
268265
return self.command.options # type: ignore
269266
return None
270267

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

discord/ext/commands/context.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,28 +283,28 @@ def cog(self) -> Cog | None:
283283
return None
284284
return self.command.cog
285285

286-
@discord.utils.cached_property
286+
@property
287287
def guild(self) -> Guild | None:
288288
"""Returns the guild associated with this context's command.
289289
None if not available.
290290
"""
291291
return self.message.guild
292292

293-
@discord.utils.cached_property
293+
@property
294294
def channel(self) -> MessageableChannel:
295295
"""Returns the channel associated with this context's command.
296296
Shorthand for :attr:`.Message.channel`.
297297
"""
298298
return self.message.channel
299299

300-
@discord.utils.cached_property
300+
@property
301301
def author(self) -> User | Member:
302302
"""Union[:class:`~discord.User`, :class:`.Member`]:
303303
Returns the author associated with this context's command. Shorthand for :attr:`.Message.author`
304304
"""
305305
return self.message.author
306306

307-
@discord.utils.cached_property
307+
@property
308308
def me(self) -> Member | ClientUser:
309309
"""Union[:class:`.Member`, :class:`.ClientUser`]:
310310
Similar to :attr:`.Guild.me` except it may return the :class:`.ClientUser` in private message

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/onboarding.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424

2525
from __future__ import annotations
2626

27+
from functools import cached_property
2728
from typing import TYPE_CHECKING, Any
2829

2930
from .enums import OnboardingMode, PromptType, try_enum
3031
from .partial_emoji import PartialEmoji
31-
from .utils import MISSING, cached_property, generate_snowflake, get
32+
from .utils import MISSING, generate_snowflake, get
3233

3334
if TYPE_CHECKING:
3435
from .abc import Snowflake

discord/poll.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from __future__ import annotations
2626

2727
import datetime
28+
from functools import cached_property
2829
from typing import TYPE_CHECKING, Any
2930

3031
from . import utils
@@ -358,7 +359,7 @@ def __init__(
358359
self._expiry = None
359360
self._message = None
360361

361-
@utils.cached_property
362+
@cached_property
362363
def expiry(self) -> datetime.datetime | None:
363364
"""An aware datetime object that specifies the date and time in UTC when the poll will end."""
364365
return utils.parse_time(self._expiry)

0 commit comments

Comments
 (0)