From 633e27946da583bcabbd51d1d8753e4fb772f87e Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Tue, 28 May 2024 09:10:41 +0200 Subject: [PATCH] fix(chat): add error handling for failed sending --- bot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index cac9fb3..476a901 100644 --- a/bot.py +++ b/bot.py @@ -142,7 +142,10 @@ class Bot: # Write response # Truncate response if too long - await r.write(message, response[:2000]) + try: + await r.write(message, response[:2000]) + except Exception as e: + logging.error('Error sending response: %s', e) task.cancel()