Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add user argument to paginator.edit #2390

Merged
merged 7 commits into from Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -14,6 +14,8 @@ These changes are available on the `master` branch, but have not yet been releas

- Added `banner` parameter to `ClientUser.edit`.
([#2396](https://github.com/Pycord-Development/pycord/pull/2396))
- Added `user` argument to `Paginator.edit`.
([#2390](https://github.com/Pycord-Development/pycord/pull/2390))

### Fixed

Expand All @@ -22,6 +24,8 @@ These changes are available on the `master` branch, but have not yet been releas
- Fixed a deprecation warning from being displayed when running `python -m discord -v`
by replacing the deprecated module.
([#2392](https://github.com/Pycord-Development/pycord/pull/2392))
- Fixed `Paginator.edit` to no longer set user to the bot.
([#2390](https://github.com/Pycord-Development/pycord/pull/2390))

### Changed

Expand Down
7 changes: 6 additions & 1 deletion discord/ext/pages/pagination.py
Expand Up @@ -29,6 +29,8 @@
import discord
from discord.ext.bridge import BridgeContext
from discord.ext.commands import Context
from discord.member import Member
from discord.user import User

__all__ = (
"PaginatorButton",
Expand Down Expand Up @@ -1035,6 +1037,7 @@ async def edit(
suppress: bool | None = None,
allowed_mentions: discord.AllowedMentions | None = None,
delete_after: float | None = None,
user: User | Member | None = None,
) -> discord.Message | None:
"""Edits an existing message to replace it with the paginator contents.

Expand All @@ -1060,6 +1063,8 @@ async def edit(
are used instead.
delete_after: Optional[:class:`float`]
If set, deletes the paginator after the specified time.
user: Optional[Union[:class:`~discord.User`, :class:`~discord.Member`]]
If set, changes the user that this paginator belongs to.

Returns
-------
Expand All @@ -1079,7 +1084,7 @@ async def edit(
if page_content.custom_view:
self.update_custom_view(page_content.custom_view)

self.user = message.author
self.user = user or self.user

try:
self.message = await message.edit(
Expand Down