ygimenez / Pagination-Utils

A collection of methods to make message pagination with JDA easier.
GNU Lesser General Public License v2.1
27 stars 7 forks source link

Print all pages #8

Closed avurro closed 3 years ago

avurro commented 3 years ago

Is your feature request related to a problem? Please describe. Both the pagination and the categorization become hateful when the pages become many.

Describe the solution you'd like It would be great to add (optionally) an emoji that allows sequential printing of all pages.

ygimenez commented 3 years ago

Unfortunately, the very reason for using pagination is how limited embed space is. You could, depending on the amount of data, put everything in one big embed, but you'll be capped really quick (trust me, really quick).

You kinda can create what you're asking by using Pages.buttonize() to create a replica of the paginate method and add an extra button for showing the big embed, but again, you can put only so much data in it.

avurro commented 3 years ago

This is not what I asked for. what I ask is an emoji that allows you to print all the created embeds in sequence, not to combine them into one.

avurro commented 3 years ago

Why do you close the issues without waiting for applicant's response? 😕

ygimenez commented 3 years ago

You're always free to reopen it, I closed because I understood you wanted all the pages in a single embed. Also, this is the first issue I closed without waiting response.

ygimenez commented 3 years ago

Discord doesn't allow more than one embed per message, this is an API limit. Sending multiple messages would fall into API abuse due to ratelimits.

avurro commented 3 years ago

image As you can see it is possible instead.

image Pressing the :scroll: emoji prints all pages in sequence for this bot.

Can you replicate this feature?

ygimenez commented 3 years ago

image As I said, the only way to do that is by sending multiple messages, with one embed per message (only webhooks can send 10/message), which will easily become api abuse if you have many pages.

avurro commented 3 years ago

As I said, the only way to do that is by sending multiple messages, with one embed per message

But that's what I'm asking from the title of this issue: Print all pages, which does not mean print all in one block, but print all embeds.

which will easily become api abuse if you have many pages.

This bot print 5 embeds in sequence and there aren't problems.

Do you think you can do the same?

ygimenez commented 3 years ago

But that's what I'm asking from the title of this issue: Print all pages, which does not mean print all in one block, but print all embeds.

Which I answered right after I reopened the issue.

Do you think you can do the same?

I definitely can do the same, but again, 5 pages is one story, 50 pages is a whole different story (you said "...when the pages become many"). The current ratelimit, if I recall correctly, is 5 messages per 5 seconds per channel, which means if you had to print 50 pages it'd take roughly 50 seconds, resulting in a massive spam if someone clicks twice or more.

This would effectively DDoS your bot, or even crash Discord servers (nuke).

avurro commented 3 years ago

I understand what you are saying, but I assure you that this bot writes all the pages instantly, without any kind of delay.

This implementation would make your library complete.

Release it and let's do some tests, what do you think about?

ygimenez commented 3 years ago

It does print instantly because it sacrifices quantity over speed. It's impossible to circumvent Discord ratelimits, you can see it in action yourself by putting a .sendMessage("test") inside a loop then observing the huge delay after a few messages.

avurro commented 3 years ago

You can add this feature with a waning: "in case of numerous pages, discord rate limits will take over".

ygimenez commented 3 years ago

By numerous I mean anything above 5 pages, it makes no sense to implement such limited feature. You can make this feature yourself by using Pages.buttonize() to execute a loop which prints each page, that method gives you the freedom to create any custom button.

TL;DR: This feature is considered API abuse, will not be implemented.

avurro commented 3 years ago

It will mean that I clone the project and implement it myself.

Dozens of bots implement this feature, having a limitation in print does not mean going to jail if it occurs :expressionless:

ygimenez commented 3 years ago

Sure, you're free to implement it yourself, just don't blame me if you get your account banned 😄

avurro commented 3 years ago

There is no ban, Discord simply blocks text sharing. Don't be afraid man! :punch:

Cabbasca commented 9 months ago

Discord allows up to 10 embeds in one message

ygimenez commented 9 months ago

Discord allows up to 10 embeds in one message

They did add that functionality to bots (previously limited to webhooks) recently, but although it's now possible it's outside the scope of the library (which is fragmenting data into pages and adding a framework for interactive buttons).

That said, this is achievable by simply sending the pages directly, instead of calling Pages.paginate.

If there's a higher demand for this feature i might include it in a future release.