Add height parameter to emojis
To support upcoming inline images in Element Android, and potentially some other clients. This retains the custom size for emojis (on clients that already supported it), but fixes it on clients that handle scaling exclusively though the height and width of the img element (such as SchildiChat and the upcoming Element Android inline images).
This commit is contained in:
parent
165047581f
commit
1ffa300741
1 changed files with 1 additions and 1 deletions
2
main.py
2
main.py
|
@ -355,7 +355,7 @@ async def message_callback(room: nio.MatrixRoom, event: nio.RoomMessageText) ->
|
||||||
with open(settings["emojis_path"], "w") as f:
|
with open(settings["emojis_path"], "w") as f:
|
||||||
json.dump(emojis, f)
|
json.dump(emojis, f)
|
||||||
# Replace the emoij with the respective file
|
# Replace the emoij with the respective file
|
||||||
new_body = new_body.replace(":" + emoji + ":" + ("" if not sizeset else f"{size}:"), f"<img src=\"{emojis[size][emoji]}\" alt=\"{emoji}\">", 1)
|
new_body = new_body.replace(":" + emoji + ":" + ("" if not sizeset else f"{size}:"), f"<img height=\"{size}\" src=\"{emojis[size][emoji]}\" alt=\"{emoji}\">", 1)
|
||||||
# Text replace processor
|
# Text replace processor
|
||||||
if event.body.count(";") > 1:
|
if event.body.count(";") > 1:
|
||||||
for to_replace in text_replace.keys():
|
for to_replace in text_replace.keys():
|
||||||
|
|
Loading…
Reference in a new issue