From 059d350e9e2f03c4d72168d10710a088514203c8 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sat, 7 Dec 2024 00:18:06 +0100 Subject: [PATCH] Conditional teardown only if correctly initialised --- mostr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mostr.py b/mostr.py index 9409bc94..d6f4c8bd 100644 --- a/mostr.py +++ b/mostr.py @@ -120,7 +120,8 @@ class MostrHandler: bot_handler.react(message, 'check') def __del__(self): - self.relays.close_connections() - print('Terminated Mostr Bot') + if hasattr(self, 'relays'): + self.relays.close_connections() + print('Terminated Mostr Bot') handler_class = MostrHandler