discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 1000 #9726
Unanswered
YungPingXu
asked this question in
General
Replies: 2 comments 2 replies
-
@YungPingXu This is normal. See #9722 (comment) |
Beta Was this translation helpful? Give feedback.
2 replies
-
If you want to filter specific logs from showing up you need to use a import logging
class GatewayEventFilter(logging.Filter):
def __init__(self) -> None:
super().__init__('discord.gateway')
def filter(self, record: logging.LogRecord) -> bool:
if record.exc_info is not None and isinstance(record.exc_info[1], discord.ConnectionClosed):
return False
return True
logging.getLogger('discord.gateway').addFilter(GatewayEventFilter())
# client related stuff goes here |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I run my discord.py bot on my win11 desktop computer 24/7.
However, the following error occurred once in a while.
Attempting a reconnect in 0.30s
Traceback (most recent call last):
File "venv\lib\site-packages\discord\client.py", line 659, in connect
await self.ws.poll_event()
File "venv\lib\site-packages\discord\gateway.py", line 646, in poll_event
raise ConnectionClosed(self.socket, shard_id=self.shard_id, code=code) from None
discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 1000
This error does not affect the program and the program is still running normally, but I want to ignore or catch this error message.
Does anyone know how to ignore or catch the above error?
Thanks~
Beta Was this translation helpful? Give feedback.
All reactions