Skip to content
8 changes: 4 additions & 4 deletions discord/partial_emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ def from_str(cls: type[PE], value: str) -> PE:
:class:`PartialEmoji`
The partial emoji from this string.
"""
if value.startswith(":") and value.endswith(":") and len(value) > 2:
name = value[1:-1]
if unicode_emoji := utils.EMOJIS_MAP.get(name):
return cls(name=unicode_emoji, id=None, animated=False)
value = value.removeprefix(":").removesuffix(":")
if unicode_emoji := utils.EMOJIS_MAP.get(value):
return cls(name=unicode_emoji, id=None, animated=False)

match = cls._CUSTOM_EMOJI_RE.match(value)
if match is not None:
groups = match.groupdict()
Expand Down
Loading