Send larger emojis if no other content in message
This commit is contained in:
parent
61a60ea4c7
commit
5838afffee
1 changed files with 8 additions and 2 deletions
10
main.py
10
main.py
|
@ -113,6 +113,12 @@ class MatrixClient(nio.AsyncClient):
|
||||||
return resp.content_uri
|
return resp.content_uri
|
||||||
|
|
||||||
async def get_fmt_body(self, body, emotes):
|
async def get_fmt_body(self, body, emotes):
|
||||||
|
# Send larger emojis if there is no other content in message
|
||||||
|
if len(body.split("]")[1].split()) == 1:
|
||||||
|
emote_size = "64"
|
||||||
|
else:
|
||||||
|
emote_size = "32"
|
||||||
|
|
||||||
# Markdown code blocks
|
# Markdown code blocks
|
||||||
replace = "```"
|
replace = "```"
|
||||||
for i in range(body.count(replace)):
|
for i in range(body.count(replace)):
|
||||||
|
@ -128,8 +134,8 @@ class MatrixClient(nio.AsyncClient):
|
||||||
if emote_:
|
if emote_:
|
||||||
emote = f":{emote}:"
|
emote = f":{emote}:"
|
||||||
body = body.replace(
|
body = body.replace(
|
||||||
emote, f"""<img alt=\"{emote}\" title=\"{emote}\"
|
emote, f"""<img alt=\"{emote}\" title=\"{emote}\" \
|
||||||
height=\"32\" src=\"{emote_}\" data-mx-emoticon />"""
|
height=\"{emote_size}\" src=\"{emote_}\" data-mx-emoticon />"""
|
||||||
)
|
)
|
||||||
|
|
||||||
return body
|
return body
|
||||||
|
|
Loading…
Reference in a new issue