Fixed scheduler-related issues

This commit is contained in:
Profitroll 2024-02-19 23:07:38 +01:00
parent 40376d2e6d
commit d5691c2bbb
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2

View File

@ -14,6 +14,9 @@ class PycordBot(LibPycordBot):
self.client_session = ClientSession() self.client_session = ClientSession()
if self.scheduler is None:
return
# Scheduler job for DHL parcel tracking # Scheduler job for DHL parcel tracking
self.scheduler.add_job( self.scheduler.add_job(
update_tracks_dhl, update_tracks_dhl,
@ -40,6 +43,8 @@ class PycordBot(LibPycordBot):
async def close(self, *args: Any, **kwargs: Any) -> None: async def close(self, *args: Any, **kwargs: Any) -> None:
await self.client_session.close() await self.client_session.close()
self.scheduler.shutdown()
if self.scheduler is not None:
self.scheduler.shutdown()
await super().close(*args, **kwargs) await super().close(*args, **kwargs)