From 699a97f3eb3fbb90b9b019ef15f5d770838d24af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=B3=E2=B1=A0=E2=82=A5=C3=98=E2=82=B2?= <47316655+SolitudePy@users.noreply.github.com> Date: Mon, 2 Mar 2026 22:11:04 +0200 Subject: [PATCH] Fix aiohttp websocket timeout deprecation warning --- discord/http.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/discord/http.py b/discord/http.py index 0219c1196..05c1e69fc 100644 --- a/discord/http.py +++ b/discord/http.py @@ -551,11 +551,16 @@ class HTTPClient: self.__session = MISSING async def ws_connect(self, url: str, *, compress: int = 0) -> aiohttp.ClientWebSocketResponse: + try: + timeout: Any = aiohttp.ClientWSTimeout(ws_close=30.0) # pyright: ignore[reportCallIssue] + except (AttributeError, TypeError): + timeout = 30.0 + kwargs = { 'proxy_auth': self.proxy_auth, 'proxy': self.proxy, 'max_msg_size': 0, - 'timeout': 30.0, + 'timeout': timeout, 'autoclose': False, 'headers': { 'User-Agent': self.user_agent,