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:
deadcade 2022-07-28 01:05:52 +02:00
parent 165047581f
commit 1ffa300741

View file

@ -355,7 +355,7 @@ async def message_callback(room: nio.MatrixRoom, event: nio.RoomMessageText) ->
with open(settings["emojis_path"], "w") as f:
json.dump(emojis, f)
# 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
if event.body.count(";") > 1:
for to_replace in text_replace.keys():