Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct enforce_nonce implementation #2376

Merged
merged 4 commits into from Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions discord/abc.py
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
9 changes: 0 additions & 9 deletions discord/message.py
Expand Up @@ -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`]
Expand Down Expand Up @@ -752,7 +748,6 @@ class Message(Hashable):
"author",
"attachments",
"nonce",
"enforce_nonce",
"pinned",
"role_mentions",
"type",
Expand Down Expand Up @@ -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", [])
]
Expand Down Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion discord/types/message.py
Expand Up @@ -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]
Expand Down