diff --git a/discord/ext/commands/converter.py b/discord/ext/commands/converter.py index e60ac89b34..5f75aec6b3 100644 --- a/discord/ext/commands/converter.py +++ b/discord/ext/commands/converter.py @@ -41,6 +41,7 @@ ) import discord +from discord.partial_emoji import EMOJIS_MAP from .errors import * @@ -851,7 +852,8 @@ async def convert(self, ctx: Context, argument: str) -> discord.GuildEmoji: class PartialEmojiConverter(Converter[discord.PartialEmoji]): """Converts to a :class:`~discord.PartialEmoji`. - This is done by extracting the animated flag, name and ID from the emoji. + This is done by extracting the animated flag, name, and ID for custom emojis, + or by using the standard Unicode emojis supported by Discord. .. versionchanged:: 1.5 Raise :exc:`.PartialEmojiConversionFailure` instead of generic :exc:`.BadArgument` @@ -872,6 +874,14 @@ async def convert(self, ctx: Context, argument: str) -> discord.PartialEmoji: id=emoji_id, ) + if argument in EMOJIS_MAP.values(): + return discord.PartialEmoji.with_state( + ctx.bot._connection, + animated=False, + name=argument, + id=None, + ) + raise PartialEmojiConversionFailure(argument) @@ -1094,7 +1104,11 @@ def get_converter(param: inspect.Parameter) -> Any: def is_generic_type(tp: Any, *, _GenericAlias: type = _GenericAlias) -> bool: - return isinstance(tp, type) and issubclass(tp, Generic) or isinstance(tp, _GenericAlias) # type: ignore + return ( + isinstance(tp, type) + and issubclass(tp, Generic) + or isinstance(tp, _GenericAlias) + ) # type: ignore CONVERTER_MAPPING: dict[type[Any], Any] = {