Add LimitExceededError nio callback

This commit is contained in:
miruka
2019-07-04 22:25:06 -04:00
parent 55e14e96bc
commit 1db406d9af
2 changed files with 17 additions and 24 deletions

View File

@@ -143,7 +143,10 @@ class MatrixClient(nio.AsyncClient):
)
async with self.send_locks[room_id]:
print(await self.room_send(room_id, "m.room.message", content))
response = await self.room_send(room_id, "m.room.message", content)
if isinstance(response, nio.RoomSendError):
log.error("Failed to send message: %s", response)
# Callbacks for nio responses
@@ -194,6 +197,11 @@ class MatrixClient(nio.AsyncClient):
)
async def onLimitExceededError(self, resp: nio.LimitExceededError) -> None:
# TODO: show something in the client
log.warning("Failed to send message: %s", resp)
# Callbacks for nio events
# Special %tokens for event contents: