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

[BUG] Paginator extension throws on footer #1567

Open
4 tasks done
i0bs opened this issue Oct 29, 2023 · 2 comments
Open
4 tasks done

[BUG] Paginator extension throws on footer #1567

i0bs opened this issue Oct 29, 2023 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed specific condition This happens on specific condition

Comments

@i0bs
Copy link
Contributor

i0bs commented Oct 29, 2023

Library Version

5.10.0

Describe the Bug

Using Paginator from the interactions.ext.paginators extension will throw a TypeError for missing embed footers.

From @algorythm_cs on Discord:

  File "...\interactions\ext\paginators.py", line 346, in to_dict
    page.set_footer(f"Page {self.page_index+1}/{len(self.pages)}")
TypeError: Embed.set_footer() takes 1 positional argument but 2 were given

After checking the extension and Embed code, I've flagged the bug as failing to rewrite our embed, due to the method's return:

def set_footer(self, text: str, icon_url: Optional[str] = None) -> "Embed":
"""
Set the footer field of the embed.
Args:
text: The text to go in the title section
icon_url: A url of an image to use as the icon
"""
self.footer = EmbedFooter(text=text, icon_url=icon_url)
return self

This is neglected when converting embeds to dictionaries within the paginator:

if not page.footer:
page.set_footer(f"Page {self.page_index+1}/{len(self.pages)}")

Steps to Reproduce

  1. Create a variable containing an Embed omitting footer.
  2. Create a variable declaring a Paginator, whether from one embed, or numerous.
  3. Attempt to use .send() on the paginator.

Expected Results

A paginator should be sent without any bugs (assuming a pragmatic approach)

Minimal Reproducible Code

client = Client(...)
embeds = [Embed(title="foo")]

@slash_command()
async def replicate_bug(ctx):
    paginator = Paginator.create_from_embeds(client, *embeds)
    await paginator.send()
    await ctx.send("bar")

Traceback

No response

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.
  • I have attempted to debug this myself, and I believe this issue is with the library

Additional Information

No response

@AstreaTSS
Copy link
Member

I can't seem to replicate this at all.

@AstreaTSS
Copy link
Member

To clarify, the "Minimal Reproducible Code" actually works as is with no issues, and the original code was posted in a pastebin that's long since gone. It definitely isn't because of the return type, because while set_footer does return itself, the reference of the original embed should be updated anyways due to how Python works (the return is simply for chaining commands together, not to note that it's a new copy of the embed).

The error in general is very strange. At this point, page absolutely should be an Embed, and Embed has a set_footer function that has two non-self positional arguments. This suggests that either the user who had this bug had a corrupt installation, or this function lost a positional argument due to some situation. Needless to say, it's hard to find out.

@eightween eightween added bug Something isn't working help wanted Extra attention is needed specific condition This happens on specific condition labels Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed specific condition This happens on specific condition
Projects
None yet
Development

No branches or pull requests

3 participants