More debug

This commit is contained in:
bashrc committed 2021-11-01 17:50:46 +00:00
1 parent 775e89cd05
commit 430ed3ce4d
1 file changed
+7 -2
+7 -2
View File
@@ -246,14 +246,17 @@ def _saveCustomEmoji(session, baseDir: str, emojiName: str, url: str,
"""Saves custom emoji to file
"""
if not session:
if debug:
print('_saveCustomEmoji no session')
return
if '.' not in url:
return
ext = url.split('.')[-1]
if ext != 'png':
print('Custom emoji is wrong format ' + url)
if debug:
print('Custom emoji is wrong format ' + url)
return
emojiName = emojiName.replace(':').strip()
emojiName = emojiName.replace(':').strip().lower()
customEmojiDir = baseDir + '/emojicustom'
if not os.path.isdir(customEmojiDir):
os.mkdir(customEmojiDir)
@@ -270,6 +273,8 @@ def _saveCustomEmoji(session, baseDir: str, emojiName: str, url: str,
if not emojiJson.get(emojiName):
emojiJson[emojiName] = emojiName
saveJson(emojiJson, emojiJsonFilename)
if debug:
print('Saved custom emoji ' + emojiJsonFilename)
def replaceEmojiFromTags(session, baseDir: str,