File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -231,7 +231,7 @@ def __init__(
231
231
):
232
232
# self.ws is set in the connect method
233
233
self .ws : DiscordWebSocket = None # type: ignore
234
- self .loop : asyncio .AbstractEventLoop = loop
234
+ self ._loop : asyncio .AbstractEventLoop = loop
235
235
self ._listeners : dict [str , list [tuple [asyncio .Future , Callable [..., bool ]]]] = (
236
236
{}
237
237
)
@@ -323,6 +323,19 @@ def _get_state(self, **options: Any) -> ConnectionState:
323
323
def _handle_ready (self ) -> None :
324
324
self ._ready .set ()
325
325
326
+ @property
327
+ def loop (self ) -> asyncio .AbstractEventLoop :
328
+ """The event loop that the client uses for asynchronous operations."""
329
+ if self ._loop is MISSING :
330
+ raise RuntimeError ('loop is not set' )
331
+ return self ._loop
332
+
333
+ @loop .setter
334
+ def loop (self , value : asyncio .AbstractEventLoop ) -> None :
335
+ if not isinstance (value , asyncio .AbstractEventLoop ):
336
+ raise TypeError (f'expected a AbstractEventLoop object, got { value .__class__ .__name__ !r} instead' )
337
+ self ._loop = value
338
+
326
339
@property
327
340
def latency (self ) -> float :
328
341
"""Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds. If no websocket
You can’t perform that action at this time.
0 commit comments