diff --git a/CHANGELOG.md b/CHANGELOG.md index 7da04a101a..6aa5f3832d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2595](https://github.com/Pycord-Development/pycord/pull/2595)) - Fixed commands with `BucketType.cagegory` cooldown causing issues in private channels. ([#2603](https://github.com/Pycord-Development/pycord/pull/2603)) +- Fixed deprecation warnings from use of `get_event_loop`. + ([#2612](https://github.com/Pycord-Development/pycord/pull/2612)) ### Changed diff --git a/discord/client.py b/discord/client.py index 8ece21cf94..2501ea45c6 100644 --- a/discord/client.py +++ b/discord/client.py @@ -133,7 +133,7 @@ class Client: loop: Optional[:class:`asyncio.AbstractEventLoop`] The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via - :func:`asyncio.get_event_loop()`. + :func:`asyncio.new_event_loop()`. connector: Optional[:class:`aiohttp.BaseConnector`] The connector to use for connection pooling. proxy: Optional[:class:`str`] @@ -227,8 +227,9 @@ def __init__( # self.ws is set in the connect method self.ws: DiscordWebSocket = None # type: ignore self.loop: asyncio.AbstractEventLoop = ( - asyncio.get_event_loop() if loop is None else loop + asyncio.new_event_loop() if loop is None else loop ) + asyncio.set_event_loop(self.loop) self._listeners: dict[str, list[tuple[asyncio.Future, Callable[..., bool]]]] = ( {} ) diff --git a/discord/ext/commands/cooldowns.py b/discord/ext/commands/cooldowns.py index 6e58d37f7a..980441bf17 100644 --- a/discord/ext/commands/cooldowns.py +++ b/discord/ext/commands/cooldowns.py @@ -308,7 +308,7 @@ class _Semaphore: def __init__(self, number: int) -> None: self.value: int = number - self.loop: asyncio.AbstractEventLoop = asyncio.get_event_loop() + self.loop: asyncio.AbstractEventLoop = asyncio.new_event_loop() self._waiters: Deque[asyncio.Future] = deque() def __repr__(self) -> str: diff --git a/discord/ext/tasks/__init__.py b/discord/ext/tasks/__init__.py index 638bd831c6..ba44979487 100644 --- a/discord/ext/tasks/__init__.py +++ b/discord/ext/tasks/__init__.py @@ -330,7 +330,7 @@ def start(self, *args: Any, **kwargs: Any) -> asyncio.Task[None]: args = (self._injected, *args) if self.loop is MISSING: - self.loop = asyncio.get_event_loop() + self.loop = asyncio.new_event_loop() self._task = self.loop.create_task(self._loop(*args, **kwargs)) return self._task @@ -771,7 +771,7 @@ def loop( one used in :meth:`discord.Client.connect`. loop: :class:`asyncio.AbstractEventLoop` The loop to use to register the task, if not given - defaults to :func:`asyncio.get_event_loop`. + defaults to :func:`asyncio.new_event_loop`. Raises ------ diff --git a/discord/http.py b/discord/http.py index 26b584ba7e..73a1b6944a 100644 --- a/discord/http.py +++ b/discord/http.py @@ -173,8 +173,9 @@ def __init__( unsync_clock: bool = True, ) -> None: self.loop: asyncio.AbstractEventLoop = ( - asyncio.get_event_loop() if loop is None else loop + asyncio.new_event_loop() if loop is None else loop ) + asyncio.set_event_loop(self.loop) self.connector = connector self.__session: aiohttp.ClientSession = MISSING # filled in static_login self._locks: weakref.WeakValueDictionary = weakref.WeakValueDictionary() diff --git a/discord/player.py b/discord/player.py index 65b23ed42a..4eb253bae9 100644 --- a/discord/player.py +++ b/discord/player.py @@ -572,7 +572,7 @@ async def probe( ) codec = bitrate = None - loop = asyncio.get_event_loop() + loop = asyncio.get_running_loop() try: codec, bitrate = await loop.run_in_executor(None, lambda: probefunc(source, executable)) # type: ignore except Exception: diff --git a/discord/ui/modal.py b/discord/ui/modal.py index 966e6abe0f..5b47f729c6 100644 --- a/discord/ui/modal.py +++ b/discord/ui/modal.py @@ -62,12 +62,11 @@ def __init__( self._title = title self._children: list[InputText] = list(children) self._weights = _ModalWeights(self._children) - loop = asyncio.get_running_loop() - self._stopped: asyncio.Future[bool] = loop.create_future() + self.loop = asyncio.get_running_loop() + self._stopped: asyncio.Future[bool] = self.loop.create_future() self.__cancel_callback: Callable[[Modal], None] | None = None self.__timeout_expiry: float | None = None self.__timeout_task: asyncio.Task[None] | None = None - self.loop = asyncio.get_event_loop() def _start_listening_from_store(self, store: ModalStore) -> None: self.__cancel_callback = partial(store.remove_modal) diff --git a/docs/build/locales/api/clients.pot b/docs/build/locales/api/clients.pot index c06642dcef..4c907449a0 100644 --- a/docs/build/locales/api/clients.pot +++ b/docs/build/locales/api/clients.pot @@ -3706,7 +3706,7 @@ msgstr "" #: ../../../discord/client.py:docstring of discord.client.Client:13 #: 6c88dd4b014e4fd68019bf91e0e79449 -msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." +msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." msgstr "" #: ../../../discord/client.py:docstring of discord.client.Client:17 diff --git a/docs/build/locales/ext/tasks/index.pot b/docs/build/locales/ext/tasks/index.pot index 11580d8fb6..36cf604fd2 100644 --- a/docs/build/locales/ext/tasks/index.pot +++ b/docs/build/locales/ext/tasks/index.pot @@ -516,7 +516,7 @@ msgstr "" #: ../../../discord/ext/tasks/__init__.py:docstring of discord.ext.tasks.loop:36 #: 7e644a647eaa4981aad624c207683f5a -msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." +msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." msgstr "" #: ../../../discord/ext/tasks/__init__.py:docstring of discord.ext.tasks.loop:41 diff --git a/docs/locales/de/LC_MESSAGES/api/clients.po b/docs/locales/de/LC_MESSAGES/api/clients.po index e4b8f95258..9678052e74 100644 --- a/docs/locales/de/LC_MESSAGES/api/clients.po +++ b/docs/locales/de/LC_MESSAGES/api/clients.po @@ -1427,8 +1427,8 @@ msgstr "The maximum number of messages to store in the internal message cache. T msgid "Allow disabling the message cache and change the default size to ``1000``." msgstr "Allow disabling the message cache and change the default size to ``1000``." -msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." -msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." +msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." +msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." msgid "The connector to use for connection pooling." msgstr "The connector to use for connection pooling." diff --git a/docs/locales/de/LC_MESSAGES/ext/tasks/index.po b/docs/locales/de/LC_MESSAGES/ext/tasks/index.po index beb1ad9f67..d5735f28e8 100644 --- a/docs/locales/de/LC_MESSAGES/ext/tasks/index.po +++ b/docs/locales/de/LC_MESSAGES/ext/tasks/index.po @@ -272,8 +272,8 @@ msgstr "The number of loops to do, ``None`` if it should be an infinite loop." msgid "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." msgstr "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." -msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." -msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." +msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." +msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." msgid "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." msgstr "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." diff --git a/docs/locales/en/LC_MESSAGES/api/clients.po b/docs/locales/en/LC_MESSAGES/api/clients.po index 1bb8199023..619ad2a79d 100644 --- a/docs/locales/en/LC_MESSAGES/api/clients.po +++ b/docs/locales/en/LC_MESSAGES/api/clients.po @@ -2909,7 +2909,7 @@ msgstr "" msgid "" "The :class:`asyncio.AbstractEventLoop` to use for asynchronous " "operations. Defaults to ``None``, in which case the default event loop is" -" used via :func:`asyncio.get_event_loop()`." +" used via :func:`asyncio.new_event_loop()`." msgstr "" #: 21cc11771cf14b8482b82ed348a0bcc9 discord.client.Client:17 of diff --git a/docs/locales/en/LC_MESSAGES/ext/tasks/index.po b/docs/locales/en/LC_MESSAGES/ext/tasks/index.po index 70b909f6e3..45a8657fa0 100644 --- a/docs/locales/en/LC_MESSAGES/ext/tasks/index.po +++ b/docs/locales/en/LC_MESSAGES/ext/tasks/index.po @@ -510,7 +510,7 @@ msgstr "" #: 7e644a647eaa4981aad624c207683f5a discord.ext.tasks.loop:36 of msgid "" "The loop to use to register the task, if not given defaults to " -":func:`asyncio.get_event_loop`." +":func:`asyncio.new_event_loop`." msgstr "" #: 1b6f0ce5942646378838dbe0ab4fe0a0 discord.ext.tasks.loop:41 of diff --git a/docs/locales/es/LC_MESSAGES/api/clients.po b/docs/locales/es/LC_MESSAGES/api/clients.po index 9462b13bf7..21b45af2b2 100644 --- a/docs/locales/es/LC_MESSAGES/api/clients.po +++ b/docs/locales/es/LC_MESSAGES/api/clients.po @@ -1427,8 +1427,8 @@ msgstr "The maximum number of messages to store in the internal message cache. T msgid "Allow disabling the message cache and change the default size to ``1000``." msgstr "Allow disabling the message cache and change the default size to ``1000``." -msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." -msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." +msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." +msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." msgid "The connector to use for connection pooling." msgstr "The connector to use for connection pooling." diff --git a/docs/locales/es/LC_MESSAGES/ext/tasks/index.po b/docs/locales/es/LC_MESSAGES/ext/tasks/index.po index beb1ad9f67..d5735f28e8 100644 --- a/docs/locales/es/LC_MESSAGES/ext/tasks/index.po +++ b/docs/locales/es/LC_MESSAGES/ext/tasks/index.po @@ -272,8 +272,8 @@ msgstr "The number of loops to do, ``None`` if it should be an infinite loop." msgid "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." msgstr "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." -msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." -msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." +msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." +msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." msgid "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." msgstr "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." diff --git a/docs/locales/fr/LC_MESSAGES/api/clients.po b/docs/locales/fr/LC_MESSAGES/api/clients.po index e1a5574a28..4e7a805888 100644 --- a/docs/locales/fr/LC_MESSAGES/api/clients.po +++ b/docs/locales/fr/LC_MESSAGES/api/clients.po @@ -1427,8 +1427,8 @@ msgstr "The maximum number of messages to store in the internal message cache. T msgid "Allow disabling the message cache and change the default size to ``1000``." msgstr "Allow disabling the message cache and change the default size to ``1000``." -msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." -msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." +msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." +msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." msgid "The connector to use for connection pooling." msgstr "The connector to use for connection pooling." diff --git a/docs/locales/fr/LC_MESSAGES/ext/tasks/index.po b/docs/locales/fr/LC_MESSAGES/ext/tasks/index.po index b0f0193103..a5e761ccdb 100644 --- a/docs/locales/fr/LC_MESSAGES/ext/tasks/index.po +++ b/docs/locales/fr/LC_MESSAGES/ext/tasks/index.po @@ -272,8 +272,8 @@ msgstr "Le nombre de boucles à faire, ``None`` si elle doit être une boucle in msgid "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." msgstr "Si vous voulez gérer les erreurs et redémarrer la tâche en utilisant un algorithme de back-off exponentiel similaire à celui utilisé dans :meth:`discord.Client.connect`." -msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." -msgstr "La boucle à utiliser pour enregistrer la tâche, si elle n'est pas donnée par défaut à :func:`asyncio.get_event_loop`." +msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." +msgstr "La boucle à utiliser pour enregistrer la tâche, si elle n'est pas donnée par défaut à :func:`asyncio.new_event_loop`." msgid "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." msgstr "La fonction n'était pas une coroutine, une valeur invalide a été passée pour le paramètre ``time``, ou le paramètre ``time`` a été passé en conjonction avec des paramètres de temps relatifs." diff --git a/docs/locales/hi/LC_MESSAGES/api/clients.po b/docs/locales/hi/LC_MESSAGES/api/clients.po index e4b8f95258..9678052e74 100644 --- a/docs/locales/hi/LC_MESSAGES/api/clients.po +++ b/docs/locales/hi/LC_MESSAGES/api/clients.po @@ -1427,8 +1427,8 @@ msgstr "The maximum number of messages to store in the internal message cache. T msgid "Allow disabling the message cache and change the default size to ``1000``." msgstr "Allow disabling the message cache and change the default size to ``1000``." -msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." -msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." +msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." +msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." msgid "The connector to use for connection pooling." msgstr "The connector to use for connection pooling." diff --git a/docs/locales/hi/LC_MESSAGES/ext/tasks/index.po b/docs/locales/hi/LC_MESSAGES/ext/tasks/index.po index beb1ad9f67..d5735f28e8 100644 --- a/docs/locales/hi/LC_MESSAGES/ext/tasks/index.po +++ b/docs/locales/hi/LC_MESSAGES/ext/tasks/index.po @@ -272,8 +272,8 @@ msgstr "The number of loops to do, ``None`` if it should be an infinite loop." msgid "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." msgstr "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." -msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." -msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." +msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." +msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." msgid "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." msgstr "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." diff --git a/docs/locales/it/LC_MESSAGES/api/clients.po b/docs/locales/it/LC_MESSAGES/api/clients.po index e4b8f95258..9678052e74 100644 --- a/docs/locales/it/LC_MESSAGES/api/clients.po +++ b/docs/locales/it/LC_MESSAGES/api/clients.po @@ -1427,8 +1427,8 @@ msgstr "The maximum number of messages to store in the internal message cache. T msgid "Allow disabling the message cache and change the default size to ``1000``." msgstr "Allow disabling the message cache and change the default size to ``1000``." -msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." -msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." +msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." +msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." msgid "The connector to use for connection pooling." msgstr "The connector to use for connection pooling." diff --git a/docs/locales/it/LC_MESSAGES/ext/tasks/index.po b/docs/locales/it/LC_MESSAGES/ext/tasks/index.po index beb1ad9f67..d5735f28e8 100644 --- a/docs/locales/it/LC_MESSAGES/ext/tasks/index.po +++ b/docs/locales/it/LC_MESSAGES/ext/tasks/index.po @@ -272,8 +272,8 @@ msgstr "The number of loops to do, ``None`` if it should be an infinite loop." msgid "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." msgstr "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." -msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." -msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." +msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." +msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." msgid "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." msgstr "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." diff --git a/docs/locales/ja/LC_MESSAGES/api/clients.po b/docs/locales/ja/LC_MESSAGES/api/clients.po index c3ea149c61..4e5be3fd49 100644 --- a/docs/locales/ja/LC_MESSAGES/api/clients.po +++ b/docs/locales/ja/LC_MESSAGES/api/clients.po @@ -1427,8 +1427,8 @@ msgstr "The maximum number of messages to store in the internal message cache. T msgid "Allow disabling the message cache and change the default size to ``1000``." msgstr "Allow disabling the message cache and change the default size to ``1000``." -msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." -msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." +msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." +msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." msgid "The connector to use for connection pooling." msgstr "The connector to use for connection pooling." diff --git a/docs/locales/ja/LC_MESSAGES/build/locales/api/clients.po b/docs/locales/ja/LC_MESSAGES/build/locales/api/clients.po index 8c3a467d5b..3a364c5f5b 100644 --- a/docs/locales/ja/LC_MESSAGES/build/locales/api/clients.po +++ b/docs/locales/ja/LC_MESSAGES/build/locales/api/clients.po @@ -1436,8 +1436,8 @@ msgstr "The maximum number of messages to store in the internal message cache. T msgid "Allow disabling the message cache and change the default size to ``1000``." msgstr "Allow disabling the message cache and change the default size to ``1000``." -msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." -msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." +msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." +msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." msgid "The connector to use for connection pooling." msgstr "The connector to use for connection pooling." diff --git a/docs/locales/ja/LC_MESSAGES/build/locales/ext/tasks/index.po b/docs/locales/ja/LC_MESSAGES/build/locales/ext/tasks/index.po index 7a09c10f75..16e7358420 100644 --- a/docs/locales/ja/LC_MESSAGES/build/locales/ext/tasks/index.po +++ b/docs/locales/ja/LC_MESSAGES/build/locales/ext/tasks/index.po @@ -272,8 +272,8 @@ msgstr "The number of loops to do, ``None`` if it should be an infinite loop." msgid "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." msgstr "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." -msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." -msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." +msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." +msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." msgid "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." msgstr "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." diff --git a/docs/locales/ja/LC_MESSAGES/ext/tasks/index.po b/docs/locales/ja/LC_MESSAGES/ext/tasks/index.po index 6236de13f1..e5b138e99a 100644 --- a/docs/locales/ja/LC_MESSAGES/ext/tasks/index.po +++ b/docs/locales/ja/LC_MESSAGES/ext/tasks/index.po @@ -272,8 +272,8 @@ msgstr "The number of loops to do, ``None`` if it should be an infinite loop." msgid "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." msgstr "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." -msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." -msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." +msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." +msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." msgid "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." msgstr "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." diff --git a/docs/locales/ko/LC_MESSAGES/api/clients.po b/docs/locales/ko/LC_MESSAGES/api/clients.po index c3ea149c61..4e5be3fd49 100644 --- a/docs/locales/ko/LC_MESSAGES/api/clients.po +++ b/docs/locales/ko/LC_MESSAGES/api/clients.po @@ -1427,8 +1427,8 @@ msgstr "The maximum number of messages to store in the internal message cache. T msgid "Allow disabling the message cache and change the default size to ``1000``." msgstr "Allow disabling the message cache and change the default size to ``1000``." -msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." -msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." +msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." +msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." msgid "The connector to use for connection pooling." msgstr "The connector to use for connection pooling." diff --git a/docs/locales/ko/LC_MESSAGES/ext/tasks/index.po b/docs/locales/ko/LC_MESSAGES/ext/tasks/index.po index 6236de13f1..e5b138e99a 100644 --- a/docs/locales/ko/LC_MESSAGES/ext/tasks/index.po +++ b/docs/locales/ko/LC_MESSAGES/ext/tasks/index.po @@ -272,8 +272,8 @@ msgstr "The number of loops to do, ``None`` if it should be an infinite loop." msgid "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." msgstr "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." -msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." -msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." +msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." +msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." msgid "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." msgstr "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." diff --git a/docs/locales/pt_BR/LC_MESSAGES/api/clients.po b/docs/locales/pt_BR/LC_MESSAGES/api/clients.po index e4b8f95258..9678052e74 100644 --- a/docs/locales/pt_BR/LC_MESSAGES/api/clients.po +++ b/docs/locales/pt_BR/LC_MESSAGES/api/clients.po @@ -1427,8 +1427,8 @@ msgstr "The maximum number of messages to store in the internal message cache. T msgid "Allow disabling the message cache and change the default size to ``1000``." msgstr "Allow disabling the message cache and change the default size to ``1000``." -msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." -msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." +msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." +msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." msgid "The connector to use for connection pooling." msgstr "The connector to use for connection pooling." diff --git a/docs/locales/pt_BR/LC_MESSAGES/ext/tasks/index.po b/docs/locales/pt_BR/LC_MESSAGES/ext/tasks/index.po index beb1ad9f67..d5735f28e8 100644 --- a/docs/locales/pt_BR/LC_MESSAGES/ext/tasks/index.po +++ b/docs/locales/pt_BR/LC_MESSAGES/ext/tasks/index.po @@ -272,8 +272,8 @@ msgstr "The number of loops to do, ``None`` if it should be an infinite loop." msgid "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." msgstr "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." -msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." -msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." +msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." +msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." msgid "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." msgstr "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." diff --git a/docs/locales/ru/LC_MESSAGES/api/clients.po b/docs/locales/ru/LC_MESSAGES/api/clients.po index 3eaefdcf6b..5d1ace9927 100644 --- a/docs/locales/ru/LC_MESSAGES/api/clients.po +++ b/docs/locales/ru/LC_MESSAGES/api/clients.po @@ -1427,8 +1427,8 @@ msgstr "The maximum number of messages to store in the internal message cache. T msgid "Allow disabling the message cache and change the default size to ``1000``." msgstr "Allow disabling the message cache and change the default size to ``1000``." -msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." -msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." +msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." +msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." msgid "The connector to use for connection pooling." msgstr "The connector to use for connection pooling." diff --git a/docs/locales/ru/LC_MESSAGES/ext/tasks/index.po b/docs/locales/ru/LC_MESSAGES/ext/tasks/index.po index 967725ae47..689ef598c8 100644 --- a/docs/locales/ru/LC_MESSAGES/ext/tasks/index.po +++ b/docs/locales/ru/LC_MESSAGES/ext/tasks/index.po @@ -272,8 +272,8 @@ msgstr "The number of loops to do, ``None`` if it should be an infinite loop." msgid "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." msgstr "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." -msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." -msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." +msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." +msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." msgid "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." msgstr "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." diff --git a/docs/locales/zh_CN/LC_MESSAGES/api/clients.po b/docs/locales/zh_CN/LC_MESSAGES/api/clients.po index c3ea149c61..4e5be3fd49 100644 --- a/docs/locales/zh_CN/LC_MESSAGES/api/clients.po +++ b/docs/locales/zh_CN/LC_MESSAGES/api/clients.po @@ -1427,8 +1427,8 @@ msgstr "The maximum number of messages to store in the internal message cache. T msgid "Allow disabling the message cache and change the default size to ``1000``." msgstr "Allow disabling the message cache and change the default size to ``1000``." -msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." -msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.get_event_loop()`." +msgid "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." +msgstr "The :class:`asyncio.AbstractEventLoop` to use for asynchronous operations. Defaults to ``None``, in which case the default event loop is used via :func:`asyncio.new_event_loop()`." msgid "The connector to use for connection pooling." msgstr "The connector to use for connection pooling." diff --git a/docs/locales/zh_CN/LC_MESSAGES/ext/tasks/index.po b/docs/locales/zh_CN/LC_MESSAGES/ext/tasks/index.po index 6236de13f1..e5b138e99a 100644 --- a/docs/locales/zh_CN/LC_MESSAGES/ext/tasks/index.po +++ b/docs/locales/zh_CN/LC_MESSAGES/ext/tasks/index.po @@ -272,8 +272,8 @@ msgstr "The number of loops to do, ``None`` if it should be an infinite loop." msgid "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." msgstr "Whether to handle errors and restart the task using an exponential back-off algorithm similar to the one used in :meth:`discord.Client.connect`." -msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." -msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.get_event_loop`." +msgid "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." +msgstr "The loop to use to register the task, if not given defaults to :func:`asyncio.new_event_loop`." msgid "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." msgstr "The function was not a coroutine, an invalid value for the ``time`` parameter was passed, or ``time`` parameter was passed in conjunction with relative time parameters." diff --git a/examples/basic_voice.py b/examples/basic_voice.py index 2525415762..833a4fbaac 100644 --- a/examples/basic_voice.py +++ b/examples/basic_voice.py @@ -43,7 +43,7 @@ def __init__(self, source: discord.AudioSource, *, data: dict, volume: float = 0 @classmethod async def from_url(cls, url, *, loop=None, stream=False): - loop = loop or asyncio.get_event_loop() + loop = loop or asyncio.get_running_loop() data = await loop.run_in_executor( None, lambda: ytdl.extract_info(url, download=not stream) )