Browse Source

Fix mention_author suppressing all mentions

pull/7719/head
z03h 3 years ago
committed by GitHub
parent
commit
8d86ee3fe3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      discord/http.py
  2. 2
      discord/mentions.py

11
discord/http.py

@ -53,6 +53,7 @@ import aiohttp
from .errors import HTTPException, Forbidden, NotFound, LoginFailure, DiscordServerError, GatewayNotFound from .errors import HTTPException, Forbidden, NotFound, LoginFailure, DiscordServerError, GatewayNotFound
from .gateway import DiscordClientWebSocketResponse from .gateway import DiscordClientWebSocketResponse
from .file import File from .file import File
from .mentions import AllowedMentions
from . import __version__, utils from . import __version__, utils
from .utils import MISSING from .utils import MISSING
@ -63,7 +64,6 @@ if TYPE_CHECKING:
from .ui.view import View from .ui.view import View
from .embeds import Embed from .embeds import Embed
from .mentions import AllowedMentions
from .message import Attachment from .message import Attachment
from .flags import MessageFlags from .flags import MessageFlags
from .enums import ( from .enums import (
@ -217,12 +217,9 @@ def handle_message_parameters(
payload['allowed_mentions'] = previous_allowed_mentions.to_dict() payload['allowed_mentions'] = previous_allowed_mentions.to_dict()
if mention_author is not None: if mention_author is not None:
try: if 'allowed_mentions' not in payload:
payload['allowed_mentions']['replied_user'] = mention_author payload['allowed_mentions'] = AllowedMentions().to_dict()
except KeyError: payload['allowed_mentions']['replied_user'] = mention_author
payload['allowed_mentions'] = {
'replied_user': mention_author,
}
if attachments is MISSING: if attachments is MISSING:
attachments = files attachments = files

2
discord/mentions.py

@ -23,7 +23,7 @@ DEALINGS IN THE SOFTWARE.
""" """
from __future__ import annotations from __future__ import annotations
from typing import Union, List, TYPE_CHECKING, Any, Union from typing import Union, List, TYPE_CHECKING, Any
# fmt: off # fmt: off
__all__ = ( __all__ = (

Loading…
Cancel
Save