From f56064f1e16679ee72b51867c9659682c1523132 Mon Sep 17 00:00:00 2001 From: qwewqa <198e559dbd446d973355f415bdfa34@gmail.com> Date: Sat, 23 Jan 2021 23:19:27 -0500 Subject: [PATCH] remove message and context arguments from reaction message callback --- miyu_bot/commands/cogs/card.py | 2 +- miyu_bot/commands/common/reaction_message.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/miyu_bot/commands/cogs/card.py b/miyu_bot/commands/cogs/card.py index 69996eb..29dd969 100644 --- a/miyu_bot/commands/cogs/card.py +++ b/miyu_bot/commands/cogs/card.py @@ -58,7 +58,7 @@ class Card(commands.Cog): index = 0 limit_break = 1 - async def callback(emoji, _ctx, _message): + async def callback(emoji): nonlocal index nonlocal limit_break try: diff --git a/miyu_bot/commands/common/reaction_message.py b/miyu_bot/commands/common/reaction_message.py index 8d64812..c98c2b1 100644 --- a/miyu_bot/commands/common/reaction_message.py +++ b/miyu_bot/commands/common/reaction_message.py @@ -15,7 +15,7 @@ async def run_tabbed_message(ctx: Context, emojis: List[AnyEmoji], embeds: List[ message = await ctx.send(files=files, embed=embeds[starting_index]) - async def callback(emoji, _ctx, _message): + async def callback(emoji): await message.edit(embed=embeds[emojis.index(emoji)]) await run_reaction_message(ctx, message, emojis, callback, timeout) @@ -28,7 +28,7 @@ async def run_dynamically_paged_message(ctx: Context, embed_generator: Callable[ message = await ctx.send(embed=embed_generator(0)) - async def callback(emoji, _ctx, _message): + async def callback(emoji): if emoji == left_arrow: new_embed = embed_generator(-1) elif emoji == right_arrow: @@ -94,7 +94,7 @@ async def run_paged_message(ctx: Context, base_embed: discord.Embed, content: Li index = 0 - async def callback(emoji, _ctx, _message): + async def callback(emoji): nonlocal index start_index = index if emoji == double_left_arrow: @@ -114,7 +114,7 @@ async def run_paged_message(ctx: Context, base_embed: discord.Embed, content: Li async def run_reaction_message(ctx: Context, message: Message, emojis: List[AnyEmoji], - callback: Callable[[AnyEmoji, Context, Message], Awaitable[None]], timeout=300): + callback: Callable[[AnyEmoji], Awaitable[None]], timeout=300): for emoji in emojis: await message.add_reaction(emoji) @@ -124,7 +124,7 @@ async def run_reaction_message(ctx: Context, message: Message, emojis: List[AnyE while True: try: reaction, user = await ctx.bot.wait_for('reaction_add', timeout=timeout, check=check) - await callback(reaction.emoji, ctx, message) + await callback(reaction.emoji) await message.remove_reaction(reaction, user) except asyncio.TimeoutError: for emoji in emojis: