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

Add a way to pass an interaction for a paginator to update #1093

Closed
Andell4301 opened this issue Feb 28, 2022 · 0 comments · Fixed by #1227 or #1258
Closed

Add a way to pass an interaction for a paginator to update #1093

Andell4301 opened this issue Feb 28, 2022 · 0 comments · Fixed by #1227 or #1258
Assignees
Labels
ext.pages Relating to ext.pages feature request New feature request status: in progress Work in Progess
Milestone

Comments

@Andell4301
Copy link

Summary

Addition of a way to pass an existing interaction for a paginator to update

What is the feature request for?

discord.ext.pages

The Problem

Currently, I don't know of a clean and simple way to tell a paginator to update an existing interaction as opposed to sending the paginator as a new response, as in the following scenario:

if condition:
  initial = await ctx.respond(embed=some_embed, view=some_view)
else:
  initial = None

if initial:
"""
Edit initial to be the paginator. So replace its embeds, message content, view, etc. as if it was a totally new response, but its editing the existing interaction
"""
else:
  await paginator.respond(ctx.interaction)

The Ideal Solution

To be able to pass in an interaction for the paginator to edit

The Current Solution

I was able to replicate the functionality I want by doing the following:

if initial:
    paginator.user = ctx.author
    paginator.message = await initial.original_message()
    paginator.update_buttons()
    embed = paginator.pages[paginator.current_page]
    embed = paginator.get_page_content(embed)
    await initial.edit_original_message(view=paginator, embeds=embed)
else:
    await paginator.respond(ctx.interaction)

Additional Context

No response

@Andell4301 Andell4301 added the feature request New feature request label Feb 28, 2022
@krittick krittick self-assigned this Feb 28, 2022
@krittick krittick added the ext.pages Relating to ext.pages label Feb 28, 2022
@krittick krittick added this to the v2.1 milestone Feb 28, 2022
@krittick krittick added the status: in progress Work in Progess label Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ext.pages Relating to ext.pages feature request New feature request status: in progress Work in Progess
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants