Conditional teardown only if correctly initialised
This commit is contained in:
parent
8dff69813e
commit
059d350e9e
1 changed files with 3 additions and 2 deletions
5
mostr.py
5
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
|
||||
|
|
Loading…
Add table
Reference in a new issue