resource folder
This commit is contained in:
+3
-2
@@ -1,7 +1,8 @@
|
|||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from os import path
|
|
||||||
|
from .utils import get_resource_path
|
||||||
|
|
||||||
EXTRA_EMOJI = {
|
EXTRA_EMOJI = {
|
||||||
"thumbup": "1f44d",
|
"thumbup": "1f44d",
|
||||||
@@ -68,7 +69,7 @@ regex = re.compile("(<a?:[\\w\\-\\~]+:\\d+>|:[\\w\\-\\~]+:)")
|
|||||||
def load_emojis():
|
def load_emojis():
|
||||||
global global_list, unicode_list, regex
|
global global_list, unicode_list, regex
|
||||||
emoji_list = []
|
emoji_list = []
|
||||||
with open(path.join(path.dirname(__file__), "emoji.json"), mode="r") as f:
|
with open(get_resource_path("emoji.json"), mode="r") as f:
|
||||||
emoji_list = json.loads(f.readline().strip())
|
emoji_list = json.loads(f.readline().strip())
|
||||||
for emoji in EXTRA_EMOJI:
|
for emoji in EXTRA_EMOJI:
|
||||||
emoji_list += [{"short_name": emoji, "unified": EXTRA_EMOJI[emoji]}]
|
emoji_list += [{"short_name": emoji, "unified": EXTRA_EMOJI[emoji]}]
|
||||||
|
|||||||
@@ -26,6 +26,12 @@ def is_extension(filepath: str, ext_list: List[str]) -> bool:
|
|||||||
return file_extension in ext_list
|
return file_extension in ext_list
|
||||||
|
|
||||||
|
|
||||||
|
def get_resource_path(filename: str) -> str:
|
||||||
|
return os.path.realpath(
|
||||||
|
os.path.join(os.path.dirname(__file__), "..", "resources", filename)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# LISTS
|
# LISTS
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user