From 9a074e609761c81a5a1c0b6a17e0dd652ef18556 Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 8 Dec 2019 12:46:25 -0400 Subject: [PATCH] Improve bad event types messages --- src/python/nio_callbacks.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/python/nio_callbacks.py b/src/python/nio_callbacks.py index 3b621287..fdaa4ae8 100644 --- a/src/python/nio_callbacks.py +++ b/src/python/nio_callbacks.py @@ -97,7 +97,7 @@ class NioCallbacks: async def onRoomMessageUnknown(self, room, ev) -> None: - co = "%1 sent a message this client doesn't understand" + co = f"%1 sent an unsupported {ev.msgtype} message" await self.client.register_nio_event(room, ev, content=co) @@ -332,22 +332,25 @@ class NioCallbacks: async def onBadEvent(self, room, ev) -> None: - co = "%1 sent a malformed event" + co = f"%1 sent a malformed {ev.type} event" await self.client.register_nio_event(room, ev, content=co) async def onUnknownBadEvent(self, room, ev) -> None: - co = "%1 sent a malformed event lacking the minimal structure" + co = "%1 sent a malformed event lacking a minimal structure" await self.client.register_nio_event(room, ev, content=co) async def onUnknownEvent(self, room, ev) -> None: - co = "%1 sent an event this client doesn't understand" + co = f"%1 sent an unsupported {ev.type} event" await self.client.register_nio_event(room, ev, content=co) async def onUnknownEncryptedEvent(self, room, ev) -> None: - co = "%1 sent an event this client doesn't know how to decrypt" + co = ( + f"%1 sent an {ev.type} event encrypted with " + f"unsupported {ev.algorithm} algorithm" + ) await self.client.register_nio_event(room, ev, content=co)