resource folder
This commit is contained in:
+3
-2
@@ -1,7 +1,8 @@
|
||||
import re
|
||||
import json
|
||||
import logging
|
||||
from os import path
|
||||
|
||||
from .utils import get_resource_path
|
||||
|
||||
EXTRA_EMOJI = {
|
||||
"thumbup": "1f44d",
|
||||
@@ -68,7 +69,7 @@ regex = re.compile("(<a?:[\\w\\-\\~]+:\\d+>|:[\\w\\-\\~]+:)")
|
||||
def load_emojis():
|
||||
global global_list, unicode_list, regex
|
||||
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())
|
||||
for emoji in EXTRA_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
|
||||
|
||||
|
||||
def get_resource_path(filename: str) -> str:
|
||||
return os.path.realpath(
|
||||
os.path.join(os.path.dirname(__file__), "..", "resources", filename)
|
||||
)
|
||||
|
||||
|
||||
# LISTS
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user