Skip to content

Commit e69a7bd

Browse files
Update discord/partial_emoji.py
Co-authored-by: Paillat <[email protected]> Signed-off-by: Lala Sabathil <[email protected]>
1 parent fa24b73 commit e69a7bd

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

discord/partial_emoji.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,10 @@ def from_str(cls: type[PE], value: str) -> PE:
150150
:class:`PartialEmoji`
151151
The partial emoji from this string.
152152
"""
153-
if value.startswith(":") and value.endswith(":"):
153+
if value.startswith(":") and value.endswith(":") and len(value) > 2:
154154
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-
155+
if unicode_emoji := EMOJIS_MAP.get(name):
156+
return cls(name=unicode_emoji, id=None, animated=False)
159157
match = cls._CUSTOM_EMOJI_RE.match(value)
160158
if match is not None:
161159
groups = match.groupdict()

0 commit comments

Comments
 (0)