Repository: Pycord-Development/pycord

Issue:
Paginator Groups Update The Wrong Command
### Summary

When using consecutive commands with paginator groups, the paginator groups will update the wrong version of the command

### Reproduction Steps

When using commands with paginators that utilize page groups, if you use the command twice in a row, the select menu on the first command will update the second command instead. This does not include the buttons. Only the select menu updates the wrong command.

If two users use the command consecutively, the user who used the command second will experience the same behavior as above, but the first user will be unable to interact with their paginator at all. In this case, that _includes_ the buttons, not just the select menu.

Here is a video of the first behavior:
https://user-images.githubusercontent.com/56235026/163559258-ea06a5b2-5df0-49bd-8c97-0eb3bd8b85eb.mp4

### Minimal Reproducible Code

```python
import discord
from discord.ext import pages
bot = discord.Bot()


@bot.slash_command()
async def test(ctx):
    page_groups = [
        pages.PageGroup(label="Group 1", pages=[discord.Embed(title="A"), discord.Embed(title="B")], description=""),
        pages.PageGroup(label="Group 2", pages=[discord.Embed(title="C"), discord.Embed(title="D")], description="")
    ]

    paginator = pages.Paginator(pages=page_groups, show_menu=True)

    await paginator.respond(ctx.interaction)

bot.run("TOKEN")
```


### Expected Results

The paginator updates the correct command.

### Actual Results

The paginator updates the incorrect command.

### Intents

None

### System Information

- Python v3.10.1-final
- py-cord v2.0.0-beta
    - py-cord pkg_resources: v2.0.0b7
- aiohttp v3.8.1
- system info: Windows 10 10.0.19044

### Checklist

- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.

### Additional Context

This issue was introduced in https://github.com/Pycord-Development/pycord/commit/e06af8c0b0fe31ded71083aa8ac095fe3534cf85
Paginator Groups Update The Wrong Command
### Summary

When using consecutive commands with paginator groups, the paginator groups will update the wrong version of the command

### Reproduction Steps

When using commands with paginators that utilize page groups, if you use the command twice in a row, the select menu on the first command will update the second command instead. This does not include the buttons. Only the select menu updates the wrong command.

If two users use the command consecutively, the user who used the command second will experience the same behavior as above, but the first user will be unable to interact with their paginator at all. In this case, that _includes_ the buttons, not just the select menu.

Here is a video of the first behavior:
https://user-images.githubusercontent.com/56235026/163559258-ea06a5b2-5df0-49bd-8c97-0eb3bd8b85eb.mp4

### Minimal Reproducible Code

```python
import discord
from discord.ext import pages
bot = discord.Bot()


@bot.slash_command()
async def test(ctx):
    page_groups = [
        pages.PageGroup(label="Group 1", pages=[discord.Embed(title="A"), discord.Embed(title="B")], description=""),
        pages.PageGroup(label="Group 2", pages=[discord.Embed(title="C"), discord.Embed(title="D")], description="")
    ]

    paginator = pages.Paginator(pages=page_groups, show_menu=True)

    await paginator.respond(ctx.interaction)

bot.run("TOKEN")
```


### Expected Results

The paginator updates the correct command.

### Actual Results

The paginator updates the incorrect command.

### Intents

None

### System Information

- Python v3.10.1-final
- py-cord v2.0.0-beta
    - py-cord pkg_resources: v2.0.0b7
- aiohttp v3.8.1
- system info: Windows 10 10.0.19044

### Checklist

- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.

### Additional Context

This issue was introduced in https://github.com/Pycord-Development/pycord/commit/e06af8c0b0fe31ded71083aa8ac095fe3534cf85


Discussion:

Resolving patch:
diff --git a/discord/ext/pages/pagination.py b/discord/ext/pages/pagination.py
--- a/discord/ext/pages/pagination.py
+++ b/discord/ext/pages/pagination.py
@@ -398,6 +398,7 @@ async def update(
         timeout: Optional[float] = None,
         custom_buttons: Optional[List[PaginatorButton]] = None,
         trigger_on_display: Optional[bool] = None,
+        interaction: Optional[discord.Interaction] = None,
     ):
         """Updates the existing :class:`Paginator` instance with the provided options.
 
@@ -432,6 +433,9 @@ async def update(
         trigger_on_display: :class:`bool`
             Whether to automatically trigger the callback associated with a `Page` whenever it is displayed.
             Has no effect if no callback exists for a `Page`.
+        interaction: Optional[:class:`discord.Interaction`]
+            The interaction to use when updating the paginator. If not provided, the paginator will be updated
+            by using its stored :attr:`message` attribute instead.
         """
 
         # Update pages and reset current_page to 0 (default)
@@ -460,7 +464,7 @@ async def update(
             self.buttons = {}
             self.add_default_buttons()
 
-        await self.goto_page(self.current_page)
+        await self.goto_page(self.current_page, interaction=interaction)
 
     async def on_timeout(self) -> None:
         """Disables all buttons when the view times out."""
@@ -1023,6 +1027,15 @@ def __init__(
         super().__init__(placeholder=placeholder, max_values=1, min_values=1, options=opts, custom_id=custom_id)
 
     async def callback(self, interaction: discord.Interaction):
+        """|coro|
+
+        The coroutine that is called when a menu option is selected.
+
+        Parameters
+        -----------
+        interaction: :class:`discord.Interaction`
+            The interaction created by selecting the menu option.
+        """
         selection = self.values[0]
         for page_group in self.page_groups:
             if selection == page_group.label:
@@ -1036,4 +1049,5 @@ async def callback(self, interaction: discord.Interaction):
                     loop_pages=page_group.loop_pages,
                     custom_view=page_group.custom_view,
                     custom_buttons=page_group.custom_buttons,
+                    interaction=interaction,
                 )


Test patch: