We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa24b73 commit e69a7bdCopy full SHA for e69a7bd
discord/partial_emoji.py
@@ -150,12 +150,10 @@ def from_str(cls: type[PE], value: str) -> PE:
150
:class:`PartialEmoji`
151
The partial emoji from this string.
152
"""
153
- if value.startswith(":") and value.endswith(":"):
+ if value.startswith(":") and value.endswith(":") and len(value) > 2:
154
name = value[1:-1]
155
- unicode_emoji = EMOJIS_MAP.get(name)
156
- if unicode_emoji:
157
- return cls(name=unicode_emoji, id=None, animated=False)
158
-
+ if unicode_emoji := EMOJIS_MAP.get(name):
+ return cls(name=unicode_emoji, id=None, animated=False)
159
match = cls._CUSTOM_EMOJI_RE.match(value)
160
if match is not None:
161
groups = match.groupdict()
0 commit comments