Conditional teardown only if correctly initialised

This commit is contained in:
xeruf 2024-12-07 00:18:06 +01:00
parent 8dff69813e
commit 059d350e9e
1 changed files with 3 additions and 2 deletions

View File

@ -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