From a86145fd92a1b84f82c20f7ee5d4141151a6fe9c Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Sat, 2 Mar 2024 09:07:23 +0100 Subject: [PATCH] fix: correct `enforce_nonce` implementation (#2376) * fix: enforce_nonce mistake * Update discord/message.py Signed-off-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com> * fix * Update CHANGELOG.md Signed-off-by: Lala Sabathil --------- Signed-off-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com> Signed-off-by: Lala Sabathil Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com> --- CHANGELOG.md | 2 +- discord/abc.py | 6 +++--- discord/message.py | 9 --------- discord/types/message.py | 1 - 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 423098cfa1..33f0ae6b09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,7 +95,7 @@ These changes are available on the `master` branch, but have not yet been releas ([#2350](https://github.com/Pycord-Development/pycord/pull/2350)) - Added support for voice channel statuses. ([#2368](https://github.com/Pycord-Development/pycord/pull/2368)) -- Added `Message.enforce_nonce`. +- Added `enforce_nonce` parameter for message sending. ([#2370](https://github.com/Pycord-Development/pycord/pull/2370)) - Added audit log support for voice channel status. ([#2373](https://github.com/Pycord-Development/pycord/pull/2373)) diff --git a/discord/abc.py b/discord/abc.py index 5c3f362745..dc2237151d 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -1611,7 +1611,7 @@ async def send( embed=embed, embeds=embeds, nonce=nonce, - enforce_nonce=nonce, + enforce_nonce=enforce_nonce, message_reference=reference, stickers=stickers, components=components, @@ -1637,7 +1637,7 @@ async def send( embed=embed, embeds=embeds, nonce=nonce, - enforce_nonce=nonce, + enforce_nonce=enforce_nonce, allowed_mentions=allowed_mentions, message_reference=reference, stickers=stickers, @@ -1655,7 +1655,7 @@ async def send( embed=embed, embeds=embeds, nonce=nonce, - enforce_nonce=nonce, + enforce_nonce=enforce_nonce, allowed_mentions=allowed_mentions, message_reference=reference, stickers=stickers, diff --git a/discord/message.py b/discord/message.py index 453b39f065..5f4d3bc994 100644 --- a/discord/message.py +++ b/discord/message.py @@ -640,10 +640,6 @@ class Message(Hashable): nonce: Optional[Union[:class:`str`, :class:`int`]] The value used by the discord guild and the client to verify that the message is successfully sent. This is not stored long term within Discord's servers and is only used ephemerally. - enforce_nonce: Optional[:class:`bool`] - Whether :attr:`nonce` is enforced to be validated. - - .. versionadded:: 2.5 embeds: List[:class:`Embed`] A list of embeds the message has. channel: Union[:class:`TextChannel`, :class:`Thread`, :class:`DMChannel`, :class:`GroupChannel`, :class:`PartialMessageable`] @@ -752,7 +748,6 @@ class Message(Hashable): "author", "attachments", "nonce", - "enforce_nonce", "pinned", "role_mentions", "type", @@ -807,7 +802,6 @@ def __init__( self.tts: bool = data["tts"] self.content: str = data["content"] self.nonce: int | str | None = data.get("nonce") - self.enforce_nonce: bool | None = data.get("enforce_nonce") self.stickers: list[StickerItem] = [ StickerItem(data=d, state=state) for d in data.get("sticker_items", []) ] @@ -989,9 +983,6 @@ def _handle_embeds(self, value: list[EmbedPayload]) -> None: def _handle_nonce(self, value: str | int) -> None: self.nonce = value - def _handle_enforce_none(self, value: bool) -> None: - self.enforce_nonce = value - def _handle_author(self, author: UserPayload) -> None: self.author = self._state.store_user(author) if isinstance(self.guild, Guild): diff --git a/discord/types/message.py b/discord/types/message.py index a36e43b696..10d819ebd4 100644 --- a/discord/types/message.py +++ b/discord/types/message.py @@ -111,7 +111,6 @@ class Message(TypedDict): mention_channels: NotRequired[list[ChannelMention]] reactions: NotRequired[list[Reaction]] nonce: NotRequired[int | str] - enforce_nonce: NotRequired[bool] webhook_id: NotRequired[Snowflake] activity: NotRequired[MessageActivity] application: NotRequired[MessageApplication]