remove message and context arguments from reaction message callback
This commit is contained in:
parent
34565ddff0
commit
f56064f1e1
@ -58,7 +58,7 @@ class Card(commands.Cog):
|
|||||||
index = 0
|
index = 0
|
||||||
limit_break = 1
|
limit_break = 1
|
||||||
|
|
||||||
async def callback(emoji, _ctx, _message):
|
async def callback(emoji):
|
||||||
nonlocal index
|
nonlocal index
|
||||||
nonlocal limit_break
|
nonlocal limit_break
|
||||||
try:
|
try:
|
||||||
|
@ -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])
|
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 message.edit(embed=embeds[emojis.index(emoji)])
|
||||||
|
|
||||||
await run_reaction_message(ctx, message, emojis, callback, timeout)
|
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))
|
message = await ctx.send(embed=embed_generator(0))
|
||||||
|
|
||||||
async def callback(emoji, _ctx, _message):
|
async def callback(emoji):
|
||||||
if emoji == left_arrow:
|
if emoji == left_arrow:
|
||||||
new_embed = embed_generator(-1)
|
new_embed = embed_generator(-1)
|
||||||
elif emoji == right_arrow:
|
elif emoji == right_arrow:
|
||||||
@ -94,7 +94,7 @@ async def run_paged_message(ctx: Context, base_embed: discord.Embed, content: Li
|
|||||||
|
|
||||||
index = 0
|
index = 0
|
||||||
|
|
||||||
async def callback(emoji, _ctx, _message):
|
async def callback(emoji):
|
||||||
nonlocal index
|
nonlocal index
|
||||||
start_index = index
|
start_index = index
|
||||||
if emoji == double_left_arrow:
|
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],
|
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:
|
for emoji in emojis:
|
||||||
await message.add_reaction(emoji)
|
await message.add_reaction(emoji)
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ async def run_reaction_message(ctx: Context, message: Message, emojis: List[AnyE
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
reaction, user = await ctx.bot.wait_for('reaction_add', timeout=timeout, check=check)
|
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)
|
await message.remove_reaction(reaction, user)
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
for emoji in emojis:
|
for emoji in emojis:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user