Skip to content
Merged
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
22 changes: 16 additions & 6 deletions discord/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import importlib.resources
import itertools
import json
import logging
import re
import sys
import types
Expand Down Expand Up @@ -100,14 +101,23 @@
"filter_params",
)

_log = logging.getLogger(__name__)

DISCORD_EPOCH = 1420070400000

with (
importlib.resources.files(__package__)
.joinpath("emojis.json")
.open(encoding="utf-8") as f
):
EMOJIS_MAP = json.load(f)
try:
with (
importlib.resources.files(__package__)
.joinpath("emojis.json")
.open(encoding="utf-8") as f
):
EMOJIS_MAP = json.load(f)
except FileNotFoundError:
_log.debug(
"Couldn't find emojis.json. Is the package data missing? Discord emojis names will not work.",
)
EMOJIS_MAP = {}


UNICODE_EMOJIS = set(EMOJIS_MAP.values())

Expand Down
Loading