Fix incorrect html pong message and bump version to 1.3.1

This commit is contained in:
Tulir Asokan 2019-07-08 18:23:12 +03:00
parent e5454924dd
commit 0d8d59eb1a
2 changed files with 3 additions and 3 deletions

View file

@ -39,11 +39,11 @@ class EchoBot(Plugin):
async def ping_handler(self, evt: MessageEvent, message: str = "") -> None:
diff = int(time() * 1000) - evt.timestamp
pretty_diff = self.prettify_diff(diff)
message = f'"{message[:20]}" took' if message else "took"
text_message = f'"{message[:20]}" took' if message else "took"
html_message = f'"{escape(message[:20])}" took' if message else "took"
content = TextMessageEventContent(
msgtype=MessageType.NOTICE, format=Format.HTML,
body=f"{evt.sender}: Pong! (ping {message} {pretty_diff} to arrive)",
body=f"{evt.sender}: Pong! (ping {text_message} {pretty_diff} to arrive)",
formatted_body=f"<a href='https://matrix.to/#/{evt.sender}'>{evt.sender}</a>: Pong! "
f"(<a href='https://matrix.to/#/{evt.room_id}/{evt.event_id}'>ping</a> {html_message} "
f"{pretty_diff} to arrive)")

View file

@ -1,6 +1,6 @@
maubot: 0.1.0
id: xyz.maubot.echo
version: 1.3.0
version: 1.3.1
license: MIT
modules:
- echo