Browse Source

Use a sequence instead of a list for AllowedMentions

pull/8265/head
Rapptz 3 years ago
parent
commit
406495b465
  1. 14
      discord/mentions.py

14
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 from typing import Union, Sequence, TYPE_CHECKING, Any
# fmt: off # fmt: off
__all__ = ( __all__ = (
@ -63,13 +63,13 @@ class AllowedMentions:
------------ ------------
everyone: :class:`bool` everyone: :class:`bool`
Whether to allow everyone and here mentions. Defaults to ``True``. Whether to allow everyone and here mentions. Defaults to ``True``.
users: Union[:class:`bool`, List[:class:`abc.Snowflake`]] users: Union[:class:`bool`, Sequence[:class:`abc.Snowflake`]]
Controls the users being mentioned. If ``True`` (the default) then Controls the users being mentioned. If ``True`` (the default) then
users are mentioned based on the message content. If ``False`` then users are mentioned based on the message content. If ``False`` then
users are not mentioned at all. If a list of :class:`abc.Snowflake` users are not mentioned at all. If a list of :class:`abc.Snowflake`
is given then only the users provided will be mentioned, provided those is given then only the users provided will be mentioned, provided those
users are in the message content. users are in the message content.
roles: Union[:class:`bool`, List[:class:`abc.Snowflake`]] roles: Union[:class:`bool`, Sequence[:class:`abc.Snowflake`]]
Controls the roles being mentioned. If ``True`` (the default) then Controls the roles being mentioned. If ``True`` (the default) then
roles are mentioned based on the message content. If ``False`` then roles are mentioned based on the message content. If ``False`` then
roles are not mentioned at all. If a list of :class:`abc.Snowflake` roles are not mentioned at all. If a list of :class:`abc.Snowflake`
@ -88,13 +88,13 @@ class AllowedMentions:
self, self,
*, *,
everyone: bool = default, everyone: bool = default,
users: Union[bool, List[Snowflake]] = default, users: Union[bool, Sequence[Snowflake]] = default,
roles: Union[bool, List[Snowflake]] = default, roles: Union[bool, Sequence[Snowflake]] = default,
replied_user: bool = default, replied_user: bool = default,
): ):
self.everyone: bool = everyone self.everyone: bool = everyone
self.users: Union[bool, List[Snowflake]] = users self.users: Union[bool, Sequence[Snowflake]] = users
self.roles: Union[bool, List[Snowflake]] = roles self.roles: Union[bool, Sequence[Snowflake]] = roles
self.replied_user: bool = replied_user self.replied_user: bool = replied_user
@classmethod @classmethod

Loading…
Cancel
Save