Skip to content

Commit

Permalink
fix: add user argument to paginator.edit (#2390)
Browse files Browse the repository at this point in the history
* patch paginator.edit

* style(pre-commit): auto fixes from pre-commit.com hooks

* changelog

* style(pre-commit): auto fixes from pre-commit.com hooks

* Update CHANGELOG.md

---------

Signed-off-by: plun1331 <plun1331@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: plun1331 <plun1331@gmail.com>
  • Loading branch information
3 people committed Mar 19, 2024
1 parent ca07054 commit 43a9ee7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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

0 comments on commit 43a9ee7

Please sign in to comment.