Remove usage of loop arg in calls to start_adding_reactions (#3644)

* fix stacklevels of warnings

* stop using loop arg when calling start_adding_reactions

* [Audio] Stop using loop arg when calling start_adding_reactions
This commit is contained in:
jack1142
2020-03-20 20:44:57 +01:00
committed by GitHub
parent 5074f2dbab
commit eebea59fe3
6 changed files with 18 additions and 8 deletions

View File

@@ -183,6 +183,7 @@ def bounded_gather_iter(
"Explicitly passing the loop will not work in Red 3.4+ and is currently ignored."
"Call this from the related event loop.",
DeprecationWarning,
stacklevel=2,
)
loop = asyncio.get_running_loop()
@@ -240,6 +241,7 @@ def bounded_gather(
"Explicitly passing the loop will not work in Red 3.4+ and is currently ignored."
"Call this from the related event loop.",
DeprecationWarning,
stacklevel=2,
)
loop = asyncio.get_running_loop()

View File

@@ -78,7 +78,7 @@ async def menu(
message = await ctx.send(current_page)
# Don't wait for reactions to be added (GH-1797)
# noinspection PyAsyncCall
start_adding_reactions(message, controls.keys(), ctx.bot.loop)
start_adding_reactions(message, controls.keys())
else:
try:
if isinstance(current_page, discord.Embed):
@@ -213,7 +213,11 @@ def start_adding_reactions(
if loop is None:
loop = asyncio.get_running_loop()
else:
warnings.warn("Explicitly passing the loop will not work in Red 3.4+", DeprecationWarning)
warnings.warn(
"Explicitly passing the loop will not work in Red 3.4+",
DeprecationWarning,
stacklevel=2,
)
return loop.create_task(task())