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

@@ -56,6 +56,7 @@ def is_mod_or_superior(ctx: "Context") -> Awaitable[bool]:
"`redbot.core.checks.is_mod_or_superior` is deprecated and will be removed in a future "
"release, please use `redbot.core.utils.mod.is_mod_or_superior` instead.",
category=DeprecationWarning,
stacklevel=2,
)
return _is_mod_or_superior(ctx.bot, ctx.author)
@@ -65,6 +66,7 @@ def is_admin_or_superior(ctx: "Context") -> Awaitable[bool]:
"`redbot.core.checks.is_admin_or_superior` is deprecated and will be removed in a future "
"release, please use `redbot.core.utils.mod.is_admin_or_superior` instead.",
category=DeprecationWarning,
stacklevel=2,
)
return _is_admin_or_superior(ctx.bot, ctx.author)
@@ -72,6 +74,8 @@ def is_admin_or_superior(ctx: "Context") -> Awaitable[bool]:
def check_permissions(ctx: "Context", perms: Dict[str, bool]) -> Awaitable[bool]:
warnings.warn(
"`redbot.core.checks.check_permissions` is deprecated and will be removed in a future "
"release, please use `redbot.core.utils.mod.check_permissions`."
"release, please use `redbot.core.utils.mod.check_permissions`.",
DeprecationWarning,
stacklevel=2,
)
return _check_permissions(ctx, perms)

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())