Fix mention_author suppressing all mentions

This commit is contained in:
z03h 2022-03-17 22:52:11 -07:00 committed by GitHub
parent 02b79eb219
commit 8d86ee3fe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 8 deletions

View File

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

View File

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