Skip to content

Commit 04dc003

Browse files
authored
Merge branch 'master' into feat/mssage-update-parse-message
Signed-off-by: Paillat <[email protected]>
2 parents d005544 + 1c65fc8 commit 04dc003

28 files changed

+421
-116
lines changed

.github/workflows/docs-localization-download.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
working-directory: ./docs
4141
- name: "Crowdin"
4242
id: crowdin
43-
uses: crowdin/[email protected].0
43+
uses: crowdin/[email protected].1
4444
with:
4545
upload_sources: false
4646
upload_translations: false

.github/workflows/docs-localization-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
sphinx-intl update -p ./build/locales ${{ vars.SPHINX_LANGUAGES }}
4545
working-directory: ./docs
4646
- name: "Crowdin"
47-
uses: crowdin/[email protected].0
47+
uses: crowdin/[email protected].1
4848
with:
4949
upload_sources: true
5050
upload_translations: false

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
# - --remove-duplicate-keys
2222
# - --remove-unused-variables
2323
- repo: https://github.com/asottile/pyupgrade
24-
rev: v3.19.1
24+
rev: v3.20.0
2525
hooks:
2626
- id: pyupgrade
2727
exclude: \.(po|pot|yml|yaml)$

CHANGELOG.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,16 @@ These changes are available on the `master` branch, but have not yet been releas
4949
([#2579](https://github.com/Pycord-Development/pycord/pull/2579))
5050
- Added new `Subscription` object and related methods/events.
5151
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
52+
- Added `Message.forward_to`, `Message.snapshots`, and other related attributes.
53+
([#2598](https://github.com/Pycord-Development/pycord/pull/2598))
5254
- Added the ability to change the API's base URL with `Route.API_BASE_URL`.
5355
([#2714](https://github.com/Pycord-Development/pycord/pull/2714))
54-
- Added the ability to pass a `datetime.time` object to `format_dt`
56+
- Added the ability to pass a `datetime.time` object to `format_dt`.
5557
([#2747](https://github.com/Pycord-Development/pycord/pull/2747))
5658
- Added `RawMessageUpdateEvent.new_message` - message update events now contain full
5759
message objects ([#2780](https://github.com/Pycord-Development/pycord/pull/2780))
60+
- Added `discord.Interaction.created_at`.
61+
([#2801](https://github.com/Pycord-Development/pycord/pull/2801))
5862

5963
### Fixed
6064

@@ -101,14 +105,22 @@ These changes are available on the `master` branch, but have not yet been releas
101105
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
102106
- Fixed `Subscription.renewal_sku_ids` not accepting `None` from the received payload.
103107
([#2709](https://github.com/Pycord-Development/pycord/pull/2709))
104-
- Fixed `ForumChannel.edit` allowing `default_reaction_emoji` to be `None`
108+
- Fixed `ForumChannel.edit` allowing `default_reaction_emoji` to be `None`.
105109
([#2739](https://github.com/Pycord-Development/pycord/pull/2739))
106110
- Fixed missing `None` type hints in `Select.__init__`.
107-
([#2746])(https://github.com/Pycord-Development/pycord/pull/2746)
111+
([#2746](https://github.com/Pycord-Development/pycord/pull/2746))
112+
- Fixed `TypeError` when using `Flag` with Python 3.11+.
113+
([#2759](https://github.com/Pycord-Development/pycord/pull/2759))
114+
- Fixed `TypeError` when specifying `thread_name` in `Webhook.send`.
115+
([#2761](https://github.com/Pycord-Development/pycord/pull/2761))
108116
- Updated `valid_locales` to support `in` and `es-419`.
109-
([#2767])(https://github.com/Pycord-Development/pycord/pull/2767)
117+
([#2767](https://github.com/Pycord-Development/pycord/pull/2767))
110118
- Fixed `Webhook.edit` not working with `attachments=[]`.
111-
([#2779])(https://github.com/Pycord-Development/pycord/pull/2779)
119+
([#2779](https://github.com/Pycord-Development/pycord/pull/2779))
120+
- Fixed GIF-based `Sticker` returning the wrong `url`.
121+
([#2781](https://github.com/Pycord-Development/pycord/pull/2781))
122+
- Fixed `VoiceClient` crashing randomly while receiving audio
123+
([#2800](https://github.com/Pycord-Development/pycord/pull/2800))
112124

113125
### Changed
114126

@@ -126,6 +138,8 @@ These changes are available on the `master` branch, but have not yet been releas
126138
changes. ([#2671](https://github.com/Pycord-Development/pycord/pull/2671))
127139
- `Entitlement.ends_at` can now be `None`.
128140
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
141+
- Changed the default value of `ApplicationCommand.nsfw` to `False`.
142+
([#2797](https://github.com/Pycord-Development/pycord/pull/2797))
129143

130144
### Deprecated
131145

@@ -136,6 +150,11 @@ These changes are available on the `master` branch, but have not yet been releas
136150
- Deprecated `Interaction.cached_channel` in favor of `Interaction.channel`.
137151
([#2658](https://github.com/Pycord-Development/pycord/pull/2658))
138152

153+
### Removed
154+
155+
- Removed deprecated support for `Option` in `BridgeCommand`. Use `BridgeOption`
156+
instead. ([#2731])(https://github.com/Pycord-Development/pycord/pull/2731))
157+
139158
## [2.6.1] - 2024-09-15
140159

141160
### Fixed

discord/abc.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,9 +1497,9 @@ async def send(
14971497
.. versionadded:: 1.4
14981498
14991499
reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`, :class:`~discord.PartialMessage`]
1500-
A reference to the :class:`~discord.Message` to which you are replying, this can be created using
1501-
:meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`. You can control
1502-
whether this mentions the author of the referenced message using the
1500+
A reference to the :class:`~discord.Message` being replied to or forwarded. This can be created using
1501+
:meth:`~discord.Message.to_reference`.
1502+
When replying, you can control whether this mentions the author of the referenced message using the
15031503
:attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions`` or by
15041504
setting ``mention_author``.
15051505
@@ -1589,9 +1589,19 @@ async def send(
15891589
allowed_mentions = allowed_mentions or AllowedMentions().to_dict()
15901590
allowed_mentions["replied_user"] = bool(mention_author)
15911591

1592+
_reference = None
15921593
if reference is not None:
15931594
try:
1594-
reference = reference.to_message_reference_dict()
1595+
_reference = reference.to_message_reference_dict()
1596+
from .message import MessageReference
1597+
1598+
if not isinstance(reference, MessageReference):
1599+
utils.warn_deprecated(
1600+
f"Passing {type(reference).__name__} to reference",
1601+
"MessageReference",
1602+
"2.7",
1603+
"3.0",
1604+
)
15951605
except AttributeError:
15961606
raise InvalidArgument(
15971607
"reference parameter must be Message, MessageReference, or"
@@ -1641,7 +1651,7 @@ async def send(
16411651
nonce=nonce,
16421652
enforce_nonce=enforce_nonce,
16431653
allowed_mentions=allowed_mentions,
1644-
message_reference=reference,
1654+
message_reference=_reference,
16451655
stickers=stickers,
16461656
components=components,
16471657
flags=flags.value,
@@ -1660,7 +1670,7 @@ async def send(
16601670
nonce=nonce,
16611671
enforce_nonce=enforce_nonce,
16621672
allowed_mentions=allowed_mentions,
1663-
message_reference=reference,
1673+
message_reference=_reference,
16641674
stickers=stickers,
16651675
components=components,
16661676
flags=flags.value,

discord/bot.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,17 @@ def _check_command(cmd: ApplicationCommand, match: Mapping[str, Any]) -> bool:
328328
]:
329329
# We have a difference
330330
return True
331-
elif getattr(cmd, check, None) != match.get(check):
332-
# We have a difference
333-
if (
331+
elif (attr := getattr(cmd, check, None)) != (
332+
found := match.get(check)
333+
):
334+
# We might have a difference
335+
if "localizations" in check and bool(attr) == bool(found):
336+
# unlike other attrs, localizations are MISSING by default
337+
continue
338+
elif (
334339
check == "default_permission"
335-
and getattr(cmd, check) is True
336-
and match.get(check) is None
340+
and attr is True
341+
and found is None
337342
):
338343
# This is a special case
339344
# TODO: Remove for perms v2

discord/channel.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3412,6 +3412,9 @@ def get_partial_message(self, message_id: int, /) -> PartialMessage:
34123412

34133413
return PartialMessage(channel=self, id=message_id)
34143414

3415+
def __repr__(self) -> str:
3416+
return f"<PartialMessageable id={self.id} type={self.type!r}>"
3417+
34153418

34163419
def _guild_channel_factory(channel_type: int):
34173420
value = try_enum(ChannelType, channel_type)

discord/commands/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def __init__(self, func: Callable, **kwargs) -> None:
233233
"__default_member_permissions__",
234234
kwargs.get("default_member_permissions", None),
235235
)
236-
self.nsfw: bool | None = getattr(func, "__nsfw__", kwargs.get("nsfw", None))
236+
self.nsfw: bool | None = getattr(func, "__nsfw__", kwargs.get("nsfw", False))
237237

238238
integration_types = getattr(
239239
func, "__integration_types__", kwargs.get("integration_types", None)
@@ -1255,7 +1255,7 @@ def __init__(
12551255
self.default_member_permissions: Permissions | None = kwargs.get(
12561256
"default_member_permissions", None
12571257
)
1258-
self.nsfw: bool | None = kwargs.get("nsfw", None)
1258+
self.nsfw: bool | None = kwargs.get("nsfw", False)
12591259

12601260
integration_types = kwargs.get("integration_types", None)
12611261
contexts = kwargs.get("contexts", None)

discord/enums.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
"EntitlementOwnerType",
7777
"IntegrationType",
7878
"InteractionContextType",
79+
"PollLayoutType",
80+
"MessageReferenceType",
7981
)
8082

8183

@@ -266,6 +268,12 @@ class MessageType(Enum):
266268
stage_raise_hand = 30
267269
stage_topic = 31
268270
guild_application_premium_subscription = 32
271+
guild_incident_alert_mode_enabled = 36
272+
guild_incident_alert_mode_disabled = 37
273+
guild_incident_report_raid = 38
274+
guild_incident_report_false_alarm = 39
275+
purchase_notification = 44
276+
poll_result = 46
269277

270278

271279
class VoiceRegion(Enum):
@@ -1055,6 +1063,13 @@ class PollLayoutType(Enum):
10551063
default = 1
10561064

10571065

1066+
class MessageReferenceType(Enum):
1067+
"""The type of the message reference object"""
1068+
1069+
default = 0
1070+
forward = 1
1071+
1072+
10581073
class SubscriptionStatus(Enum):
10591074
"""The status of a subscription."""
10601075

discord/ext/bridge/core.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,26 +98,12 @@ class BridgeExtCommand(Command):
9898
def __init__(self, func, **kwargs):
9999
super().__init__(func, **kwargs)
100100

101-
# TODO: v2.7: Remove backwards support for Option in bridge commands.
102-
for name, option in self.params.items():
101+
for option in self.params.values():
103102
if isinstance(option.annotation, Option) and not isinstance(
104103
option.annotation, BridgeOption
105104
):
106-
# Warn not to do this
107-
warn_deprecated(
108-
"Using Option for bridge commands",
109-
"BridgeOption",
110-
"2.5",
111-
"2.7",
112-
reference="https://github.com/Pycord-Development/pycord/pull/2417",
113-
stacklevel=6,
114-
)
115-
# Override the convert method of the parameter's annotated Option.
116-
# We can use the convert method from BridgeOption, and bind "self"
117-
# using a manual invocation of the descriptor protocol.
118-
# Definitely not a good approach, but gets the job done until removal.
119-
self.params[name].annotation.convert = BridgeOption.convert.__get__(
120-
self.params[name].annotation
105+
raise TypeError(
106+
f"{option.annotation.__class__.__name__} is not supported in bridge commands. Use BridgeOption instead."
121107
)
122108

123109
async def dispatch_error(self, ctx: BridgeExtContext, error: Exception) -> None:

0 commit comments

Comments
 (0)