Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ These changes are available on the `master` branch, but have not yet been releas
([#2761](https://github.com/Pycord-Development/pycord/pull/2761))
- Updated `valid_locales` to support `in` and `es-419`.
([#2767](https://github.com/Pycord-Development/pycord/pull/2767))
- Fixed support emoji aliases like `:smile:` in PartialEmoji.from_str.
([#2774](https://github.com/Pycord-Development/pycord/pull/2774))
- Fixed `Webhook.edit` not working with `attachments=[]`.
([#2779](https://github.com/Pycord-Development/pycord/pull/2779))
- Fixed GIF-based `Sticker` returning the wrong `url`.
Expand Down
1 change: 0 additions & 1 deletion discord/emojis.json

This file was deleted.

17 changes: 1 addition & 16 deletions discord/partial_emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,13 @@

from __future__ import annotations

import importlib.resources
import json
import re
from typing import TYPE_CHECKING, Any, TypedDict, TypeVar

from . import utils
from .asset import Asset, AssetMixin
from .errors import InvalidArgument

with (
importlib.resources.files(__package__)
.joinpath("emojis.json")
.open(encoding="utf-8") as f
):
EMOJIS_MAP = json.load(f)

__all__ = ("PartialEmoji",)

if TYPE_CHECKING:
Expand Down Expand Up @@ -136,7 +127,7 @@ def from_str(cls: type[PE], value: str) -> PE:
- ``name:id``
- ``<:name:id>``

If the format does not match then it is assumed to be a unicode emoji, either as Unicode characters or as a Discord alias (``:smile:``).
If the format does not match then it is assumed to be a unicode emoji.

.. versionadded:: 2.0

Expand All @@ -150,12 +141,6 @@ def from_str(cls: type[PE], value: str) -> PE:
:class:`PartialEmoji`
The partial emoji from this string.
"""
if value.startswith(":") and value.endswith(":"):
name = value[1:-1]
unicode_emoji = EMOJIS_MAP.get(name)
if unicode_emoji:
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