mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 15:06:07 +00:00
Support enforce_nonce and add random nonce for message creation
This commit is contained in:
parent
e94fb45527
commit
a0b0a97e52
@ -26,6 +26,7 @@ from __future__ import annotations
|
||||
|
||||
import copy
|
||||
import time
|
||||
import secrets
|
||||
import asyncio
|
||||
from datetime import datetime
|
||||
from typing import (
|
||||
@ -1614,6 +1615,9 @@ class Messageable:
|
||||
else:
|
||||
flags = MISSING
|
||||
|
||||
if nonce is None:
|
||||
nonce = secrets.randbits(64)
|
||||
|
||||
with handle_message_parameters(
|
||||
content=content,
|
||||
tts=tts,
|
||||
|
@ -197,6 +197,7 @@ def handle_message_parameters(
|
||||
|
||||
if nonce is not None:
|
||||
payload['nonce'] = str(nonce)
|
||||
payload['enforce_nonce'] = True
|
||||
|
||||
if message_reference is not MISSING:
|
||||
payload['message_reference'] = message_reference
|
||||
|
Loading…
x
Reference in New Issue
Block a user