Make DEFAULT_CONTROLS and ReactionPredicate.*_EMOJIS immutable (#5666)

* Make ReactionPredicate.*_EMOJIS immutable

* Make menus.DEFAULT_CONTROLS immutable

* Actually convert NUMBER_EMOJIS to tuple
This commit is contained in:
jack1142
2022-04-09 21:35:11 +02:00
committed by GitHub
parent 6cb2378e2e
commit 96e8d8cdf5
2 changed files with 31 additions and 23 deletions

View File

@@ -881,19 +881,19 @@ class ReactionPredicate(Callable[[discord.Reaction, discord.abc.User], bool]):
)
"""Tuple[str, str] : A tuple containing the tick emoji and cross emoji, in that order."""
ALPHABET_EMOJIS: ClassVar[List[str]] = [
ALPHABET_EMOJIS: ClassVar[Tuple[str, ...]] = tuple(
chr(code)
for code in range(
ord("\N{REGIONAL INDICATOR SYMBOL LETTER A}"),
ord("\N{REGIONAL INDICATOR SYMBOL LETTER Z}") + 1,
)
]
"""List[str] : A list of all 26 alphabetical letter emojis."""
)
"""Tuple[str, ...] : A tuple of all 26 alphabetical letter emojis."""
NUMBER_EMOJIS: ClassVar[List[str]] = [
NUMBER_EMOJIS: ClassVar[Tuple[str, ...]] = tuple(
chr(code) + "\N{COMBINING ENCLOSING KEYCAP}" for code in range(ord("0"), ord("9") + 1)
]
"""List[str] : A list of all single-digit number emojis, 0 through 9."""
)
"""Tuple[str, ...] : A tuple of all single-digit number emojis, 0 through 9."""
def __init__(
self, predicate: Callable[["ReactionPredicate", discord.Reaction, discord.abc.User], bool]