Discord.py: Compare command author to reaction author

Solution for Discord.py: Compare command author to reaction author
is Given Below:

For context, I have a bot command which creates an embed and adds specific reactions to it. It also keeps track of those reactions for a while (until the timeout countdown reaches 0) and responds to them according to an if statement tree. It works as expected, but the reactions to a given embed are applied to all other embeds created by this command, no matter who executes it. To handle this, I decided to add the command user’s ID to the new_page variable name. That would make it so it always generates a new embed for a different user.

The problem is I cannot seem to get the reaction author’s ID, so comparing it to the command author’s ID is impossible.

def make_page(ctx, die, result=" "):
    page = discord.Embed (
        title = die,
        description = f"""```cssn{result}```"""
    )
    return page

@client.command()
async def roller(ctx):

    author = ctx.author.id # here I'm trying to get the  command author's ID
    dice = ['d4', 'd6', 'd8', 'd10', 'd12', 'd20', 'd100']
    page = make_page(ctx, dice[0])

    message = await ctx.send(embed = page)
    await message.add_reaction('⏮')
    await message.add_reaction('◀')
    await message.add_reaction('🎲')
    await message.add_reaction('▶')
    await message.add_reaction('⏭')

    def check(reaction, user):
        return user == ctx.author

    i = 0
    reaction = None

    while True:

        if str(reaction) == '⏮':
            if reaction.users() == author:  # here I'm trying to get the reaction user's ID 
                                            # and compare it to the command author's ID
                i = 0
                new_page = make_page(ctx, dice[i])
                await message.edit(embed = new_page)

        elif str(reaction) == '◀':
            if i > 0:
                i -= 1
                new_page = make_page(ctx, dice[i])  # I would modify this section, adding the
                                                    # command author's ID to the variable
                await message.edit(embed = new_page)
        elif str(reaction) == '▶':
            if i < 6:
                i += 1
                new_page = make_page(ctx, dice[i])
                await message.edit(embed = new_page)
        elif str(reaction) == '⏭':
            i = 6
            new_page = make_page(ctx, dice[i])
            await message.edit(embed = new_page)
        
        elif str(reaction) == '🎲':
            result, explanation = rolldice.roll_dice(dice[i])
            new_page = make_page(ctx, dice[i], result)
            await message.edit(embed = new_page)

        try:

            reaction, user = await client.wait_for('reaction_add', timeout = 30.0, check = check)
            await message.remove_reaction(reaction, user)
        except:
            break

    await message.clear_reactions()

It looks like you get the user data in the line :
reaction, user = await client.wait_for('reaction_add', timeout = 30.0, check = check)
So would you just use user.id instead of reaction.users() ?
Here is what I would try:

def make_page(ctx, die, result=" "):
    page = discord.Embed (
        title = die,
        description = f"""```cssn{result}```"""
    )
    return page

@client.command()
async def roller(ctx):

    author = ctx.author.id # here I'm trying to get the  command author's ID
    dice = ['d4', 'd6', 'd8', 'd10', 'd12', 'd20', 'd100']
    page = make_page(ctx, dice[0])

    message = await ctx.send(embed = page)
    await message.add_reaction('⏮')
    await message.add_reaction('◀')
    await message.add_reaction('🎲')
    await message.add_reaction('▶')
    await message.add_reaction('⏭')

    def check(reaction, user):
        return user == ctx.author

    i = 0
    reaction = None
    user = None #to stop error as user is only defined later
    while True:

        if str(reaction) == '⏮':
            if user.id == author:  # would this work?
                i = 0
                new_page = make_page(ctx, dice[i])
                await message.edit(embed = new_page)

        elif str(reaction) == '◀':
            if i > 0:
                i -= 1
                new_page = make_page(ctx, dice[i])  
                await message.edit(embed = new_page)
        elif str(reaction) == '▶':
            if i < 6:
                i += 1
                new_page = make_page(ctx, dice[i])
                await message.edit(embed = new_page)
        elif str(reaction) == '⏭':
            i = 6
            new_page = make_page(ctx, dice[i])
            await message.edit(embed = new_page)
        
        elif str(reaction) == '🎲':
            result, explanation = rolldice.roll_dice(dice[i])
            new_page = make_page(ctx, dice[i], result)
            await message.edit(embed = new_page)

        try:

            reaction, user = await client.wait_for('reaction_add', timeout = 30.0, check = check)
            await message.remove_reaction(reaction, user)
        except:
            break

    await message.clear_reactions()

Is this what you want ? 🙂