mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 18:27:59 -05:00
Handle deprecations in asyncio (#3509)
* passing loop to certain things was deprecated. additionally, `asyncio.get_event_loop()` is being deprecated * awesome, checks are functioning as intended * fun with fixtures * we can just stop misuing that anyhow * Update redbot/pytest/downloader.py Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com> Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import asyncio
|
||||
import contextlib
|
||||
import functools
|
||||
import warnings
|
||||
from typing import Union, Iterable, Optional
|
||||
import discord
|
||||
|
||||
@@ -200,7 +201,9 @@ def start_adding_reactions(
|
||||
await message.add_reaction(emoji)
|
||||
|
||||
if loop is None:
|
||||
loop = asyncio.get_event_loop()
|
||||
loop = asyncio.get_running_loop()
|
||||
else:
|
||||
warnings.warn("Explicitly passing the loop will not work in Red 3.4+", DeprecationWarning)
|
||||
|
||||
return loop.create_task(task())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user