Skip to content

Commit a86145f

Browse files
LulalabyDorukyum
andauthored
fix: correct enforce_nonce implementation (#2376)
* fix: enforce_nonce mistake * Update discord/message.py Signed-off-by: Dorukyum <[email protected]> * fix * Update CHANGELOG.md Signed-off-by: Lala Sabathil <[email protected]> --------- Signed-off-by: Dorukyum <[email protected]> Signed-off-by: Lala Sabathil <[email protected]> Co-authored-by: Dorukyum <[email protected]>
1 parent d06b72c commit a86145f

File tree

4 files changed

+4
-14
lines changed

4 files changed

+4
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ These changes are available on the `master` branch, but have not yet been releas
9595
([#2350](https://github.com/Pycord-Development/pycord/pull/2350))
9696
- Added support for voice channel statuses.
9797
([#2368](https://github.com/Pycord-Development/pycord/pull/2368))
98-
- Added `Message.enforce_nonce`.
98+
- Added `enforce_nonce` parameter for message sending.
9999
([#2370](https://github.com/Pycord-Development/pycord/pull/2370))
100100
- Added audit log support for voice channel status.
101101
([#2373](https://github.com/Pycord-Development/pycord/pull/2373))

discord/abc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,7 @@ async def send(
16111611
embed=embed,
16121612
embeds=embeds,
16131613
nonce=nonce,
1614-
enforce_nonce=nonce,
1614+
enforce_nonce=enforce_nonce,
16151615
message_reference=reference,
16161616
stickers=stickers,
16171617
components=components,
@@ -1637,7 +1637,7 @@ async def send(
16371637
embed=embed,
16381638
embeds=embeds,
16391639
nonce=nonce,
1640-
enforce_nonce=nonce,
1640+
enforce_nonce=enforce_nonce,
16411641
allowed_mentions=allowed_mentions,
16421642
message_reference=reference,
16431643
stickers=stickers,
@@ -1655,7 +1655,7 @@ async def send(
16551655
embed=embed,
16561656
embeds=embeds,
16571657
nonce=nonce,
1658-
enforce_nonce=nonce,
1658+
enforce_nonce=enforce_nonce,
16591659
allowed_mentions=allowed_mentions,
16601660
message_reference=reference,
16611661
stickers=stickers,

discord/message.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -640,10 +640,6 @@ class Message(Hashable):
640640
nonce: Optional[Union[:class:`str`, :class:`int`]]
641641
The value used by the discord guild and the client to verify that the message is successfully sent.
642642
This is not stored long term within Discord's servers and is only used ephemerally.
643-
enforce_nonce: Optional[:class:`bool`]
644-
Whether :attr:`nonce` is enforced to be validated.
645-
646-
.. versionadded:: 2.5
647643
embeds: List[:class:`Embed`]
648644
A list of embeds the message has.
649645
channel: Union[:class:`TextChannel`, :class:`Thread`, :class:`DMChannel`, :class:`GroupChannel`, :class:`PartialMessageable`]
@@ -752,7 +748,6 @@ class Message(Hashable):
752748
"author",
753749
"attachments",
754750
"nonce",
755-
"enforce_nonce",
756751
"pinned",
757752
"role_mentions",
758753
"type",
@@ -807,7 +802,6 @@ def __init__(
807802
self.tts: bool = data["tts"]
808803
self.content: str = data["content"]
809804
self.nonce: int | str | None = data.get("nonce")
810-
self.enforce_nonce: bool | None = data.get("enforce_nonce")
811805
self.stickers: list[StickerItem] = [
812806
StickerItem(data=d, state=state) for d in data.get("sticker_items", [])
813807
]
@@ -989,9 +983,6 @@ def _handle_embeds(self, value: list[EmbedPayload]) -> None:
989983
def _handle_nonce(self, value: str | int) -> None:
990984
self.nonce = value
991985

992-
def _handle_enforce_none(self, value: bool) -> None:
993-
self.enforce_nonce = value
994-
995986
def _handle_author(self, author: UserPayload) -> None:
996987
self.author = self._state.store_user(author)
997988
if isinstance(self.guild, Guild):

discord/types/message.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ class Message(TypedDict):
111111
mention_channels: NotRequired[list[ChannelMention]]
112112
reactions: NotRequired[list[Reaction]]
113113
nonce: NotRequired[int | str]
114-
enforce_nonce: NotRequired[bool]
115114
webhook_id: NotRequired[Snowflake]
116115
activity: NotRequired[MessageActivity]
117116
application: NotRequired[MessageApplication]

0 commit comments

Comments
 (0)