41
41
)
42
42
43
43
import discord
44
+ from discord .partial_emoji import EMOJIS_MAP
44
45
45
46
from .errors import *
46
47
@@ -851,7 +852,8 @@ async def convert(self, ctx: Context, argument: str) -> discord.GuildEmoji:
851
852
class PartialEmojiConverter (Converter [discord .PartialEmoji ]):
852
853
"""Converts to a :class:`~discord.PartialEmoji`.
853
854
854
- This is done by extracting the animated flag, name and ID from the emoji.
855
+ This is done by extracting the animated flag, name, and ID for custom emojis,
856
+ or by using the standard Unicode emojis supported by Discord.
855
857
856
858
.. versionchanged:: 1.5
857
859
Raise :exc:`.PartialEmojiConversionFailure` instead of generic :exc:`.BadArgument`
@@ -872,6 +874,14 @@ async def convert(self, ctx: Context, argument: str) -> discord.PartialEmoji:
872
874
id = emoji_id ,
873
875
)
874
876
877
+ if argument in EMOJIS_MAP .values ():
878
+ return discord .PartialEmoji .with_state (
879
+ ctx .bot ._connection ,
880
+ animated = False ,
881
+ name = argument ,
882
+ id = None ,
883
+ )
884
+
875
885
raise PartialEmojiConversionFailure (argument )
876
886
877
887
@@ -1094,7 +1104,11 @@ def get_converter(param: inspect.Parameter) -> Any:
1094
1104
1095
1105
1096
1106
def is_generic_type (tp : Any , * , _GenericAlias : type = _GenericAlias ) -> bool :
1097
- return isinstance (tp , type ) and issubclass (tp , Generic ) or isinstance (tp , _GenericAlias ) # type: ignore
1107
+ return (
1108
+ isinstance (tp , type )
1109
+ and issubclass (tp , Generic )
1110
+ or isinstance (tp , _GenericAlias )
1111
+ ) # type: ignore
1098
1112
1099
1113
1100
1114
CONVERTER_MAPPING : dict [type [Any ], Any ] = {
0 commit comments