File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change 3333import importlib .resources
3434import itertools
3535import json
36+ import logging
3637import re
3738import sys
3839import types
100101 "filter_params" ,
101102)
102103
104+ _log = logging .getLogger (__name__ )
105+
103106DISCORD_EPOCH = 1420070400000
104107
105- with (
106- importlib .resources .files (__package__ )
107- .joinpath ("emojis.json" )
108- .open (encoding = "utf-8" ) as f
109- ):
110- EMOJIS_MAP = json .load (f )
108+ try :
109+ with (
110+ importlib .resources .files (__package__ )
111+ .joinpath ("emojis.json" )
112+ .open (encoding = "utf-8" ) as f
113+ ):
114+ EMOJIS_MAP = json .load (f )
115+ except FileNotFoundError :
116+ _log .debug (
117+ "Couldn't find emojis.json. Is the package data missing? Discord emojis names will not work." ,
118+ )
119+ EMOJIS_MAP = {}
120+
111121
112122UNICODE_EMOJIS = set (EMOJIS_MAP .values ())
113123
You can’t perform that action at this time.
0 commit comments