fix
This commit is contained in:
parent
5af126cee3
commit
28f57eef08
1 changed files with 8 additions and 8 deletions
16
main.py
16
main.py
|
@ -82,11 +82,10 @@ class MatrixClient(nio.AsyncClient):
|
||||||
|
|
||||||
content["format"] = "org.matrix.custom.html"
|
content["format"] = "org.matrix.custom.html"
|
||||||
|
|
||||||
content["formatted_body"] = (f"""<mx-reply><blockquote>
|
content["formatted_body"] = f"""<mx-reply><blockquote>
|
||||||
<a href="https://matrix.to/#/{config["room_id"]}/{reply_id}">In reply to</a>
|
<a href="https://matrix.to/#/{config["room_id"]}/{reply_id}">In reply to</a>
|
||||||
<a href="https://matrix.to/#/{config["username"]}">{config["username"]}</a><br>
|
<a href="https://matrix.to/#/{config["username"]}">{config["username"]}</a><br>
|
||||||
{reply_event}</blockquote></mx-reply>{message}
|
{reply_event}</blockquote></mx-reply>{message}"""
|
||||||
""")
|
|
||||||
|
|
||||||
if edit_id:
|
if edit_id:
|
||||||
content["body"] = f" * {message}"
|
content["body"] = f" * {message}"
|
||||||
|
@ -143,9 +142,10 @@ class MatrixClient(nio.AsyncClient):
|
||||||
message = message.replace(f":{emote}:", str(emote_))
|
message = message.replace(f":{emote}:", str(emote_))
|
||||||
|
|
||||||
for mention in mentions:
|
for mention in mentions:
|
||||||
member = await guild.query_members(query=mention[2])
|
if mention[2] != "":
|
||||||
if member:
|
member = await guild.query_members(query=mention[2])
|
||||||
message = message.replace(mention[1], member[0].mention)
|
if member:
|
||||||
|
message = message.replace(mention[1], member[0].mention)
|
||||||
|
|
||||||
message = message.replace("@everyone", "@\u200Beveryone")
|
message = message.replace("@everyone", "@\u200Beveryone")
|
||||||
message = message.replace("@here", "@\u200Bhere")
|
message = message.replace("@here", "@\u200Bhere")
|
||||||
|
@ -188,7 +188,7 @@ class DiscordClient(discord.Client):
|
||||||
|
|
||||||
content = await self.process_message(after)
|
content = await self.process_message(after)
|
||||||
|
|
||||||
await self.matrix_client().message_send(
|
await self.matrix_client.message_send(
|
||||||
content[0], edit_id=message_store[before.id])
|
content[0], edit_id=message_store[before.id])
|
||||||
|
|
||||||
async def on_message_delete(self, message):
|
async def on_message_delete(self, message):
|
||||||
|
@ -221,7 +221,7 @@ class DiscordClient(discord.Client):
|
||||||
for attachment in message.attachments:
|
for attachment in message.attachments:
|
||||||
content += f"\n{attachment.url}"
|
content += f"\n{attachment.url}"
|
||||||
|
|
||||||
content = f"<{message.author.name}> {content}"
|
content = f"[{message.author.name}] {content}"
|
||||||
|
|
||||||
return content, replied_event
|
return content, replied_event
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue