|
70 | 70 | from .threads import Thread |
71 | 71 | from .ui.view import BaseView |
72 | 72 | from .user import ClientUser, User |
73 | | -from .utils import _D, _FETCHABLE, MISSING, warn_if_voice_dependencies_missing |
| 73 | +from .utils import ( |
| 74 | + _D, |
| 75 | + _FETCHABLE, |
| 76 | + MISSING, |
| 77 | + _get_event_loop, |
| 78 | + warn_if_voice_dependencies_missing, |
| 79 | +) |
74 | 80 | from .webhook import Webhook |
75 | 81 | from .widget import Widget |
76 | 82 |
|
@@ -147,7 +153,7 @@ class Client: |
147 | 153 | loop: Optional[:class:`asyncio.AbstractEventLoop`] |
148 | 154 | The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. |
149 | 155 | Defaults to ``None``, in which case the default event loop is used via |
150 | | - :func:`asyncio.get_event_loop()`. |
| 156 | + :func:`asyncio.get_event_loop()` if it exists or one is created via :func:`asyncio.new_event_loop()`. |
151 | 157 | connector: Optional[:class:`aiohttp.BaseConnector`] |
152 | 158 | The connector to use for connection pooling. |
153 | 159 | proxy: Optional[:class:`str`] |
@@ -245,7 +251,7 @@ def __init__( |
245 | 251 | # self.ws is set in the connect method |
246 | 252 | self.ws: DiscordWebSocket = None # type: ignore |
247 | 253 | self.loop: asyncio.AbstractEventLoop = ( |
248 | | - asyncio.get_event_loop() if loop is None else loop |
| 254 | + _get_event_loop() if loop is None else loop |
249 | 255 | ) |
250 | 256 | self._listeners: dict[str, list[tuple[asyncio.Future, Callable[..., bool]]]] = ( |
251 | 257 | {} |
|
0 commit comments