handle check failure errors properly

This commit is contained in:
Nexus 2023-02-23 16:06:35 +00:00
parent 6e84204165
commit 09991dcefd
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -49,6 +49,12 @@ class Bot(commands.Bot):
self.console.log("Exit target 2 reached, shutting down (not connecting to discord).") self.console.log("Exit target 2 reached, shutting down (not connecting to discord).")
return return
async def on_error(self, event: str, *args, **kwargs):
e_type, e, tb = sys.exc_info()
if isinstance(e, discord.CheckFailure) and str(e) == 'The global check once functions failed.':
return
await super().on_error(event, *args, **kwargs)
async def close(self) -> None: async def close(self) -> None:
if getattr(self, "web", None) is not None: if getattr(self, "web", None) is not None:
await self.http.close() await self.http.close()