mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 17:36:15 +00:00
Allow passing Emoji in components
This commit is contained in:
@ -30,6 +30,7 @@ import os
|
||||
from .item import Item, ItemCallbackType
|
||||
from ..enums import ComponentType
|
||||
from ..partial_emoji import PartialEmoji
|
||||
from ..emoji import Emoji
|
||||
from ..interactions import Interaction
|
||||
from ..utils import MISSING
|
||||
from ..components import (
|
||||
@ -176,7 +177,7 @@ class Select(Item[V]):
|
||||
label: str,
|
||||
value: str = MISSING,
|
||||
description: Optional[str] = None,
|
||||
emoji: Optional[Union[str, PartialEmoji]] = None,
|
||||
emoji: Optional[Union[str, Emoji, PartialEmoji]] = None,
|
||||
default: bool = False,
|
||||
):
|
||||
"""Adds an option to the select menu.
|
||||
@ -195,9 +196,9 @@ class Select(Item[V]):
|
||||
description: Optional[:class:`str`]
|
||||
An additional description of the option, if any.
|
||||
Can only be up to 50 characters.
|
||||
emoji: Optional[Union[:class:`str`, :class:`PartialEmoji`]]
|
||||
emoji: Optional[Union[:class:`str`, :class:`Emoji`, :class:`PartialEmoji`]]
|
||||
The emoji of the option, if available. This can either be a string representing
|
||||
the custom or unicode emoji or an instance of :class:`PartialEmoji`.
|
||||
the custom or unicode emoji or an instance of :class:`PartialEmoji` or :class:`Emoji`.
|
||||
default: :class:`bool`
|
||||
Whether this option is selected by default.
|
||||
|
||||
@ -207,9 +208,6 @@ class Select(Item[V]):
|
||||
The number of options exceeds 25.
|
||||
"""
|
||||
|
||||
if isinstance(emoji, str):
|
||||
emoji = PartialEmoji.from_str(emoji)
|
||||
|
||||
option = SelectOption(
|
||||
label=label,
|
||||
value=value,
|
||||
|
Reference in New Issue
Block a user