-
-
Notifications
You must be signed in to change notification settings - Fork 956
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
Inline keyboard pagination #438
Inline keyboard pagination #438
Conversation
Simplify (inline) keyboard tests with helpers.
a208514
to
651c338
Compare
This is cool! Some suggestions/ideas:
In that case 'extended button layout':
Definitely! Additional ideas/notes:
|
What exactly do you mean by this? Letters instead of numbers?
Brilliant, will see how to make this customisable 👍
Yep!
Exactly what I meant by CallbackqueryCommand::registerCallbackQueryHandler('pagination_command', 'myCallbackQueryHandler');
function myCallbackQueryHandler($callback_query)
{
...
} |
Yeah, sample use: sorting /chats by letters! No idea how hard this will be to achieve though! |
For the possibility of hierarchical inheritance
Added with 6983b2c, by hiding certain buttons using a blank label. |
Will close off here, as I'll be moving this whole feature to a separate repo, as an add-on. Found this neat project that I'll be extending: |
This PR offers a simple way to add an inline pagination keyboard.
The idea has been around for a while and #436 gave me the kick to implement it.
How it works
Example command
/basicpages
BasicpagesCommand.php
In the command, implement the
InlineKeyboardPaginator
, populate the required static methods, setreply_markup
to the paginator, done!CallbackqueryCommand.php
In the callback query handler, we just need to get the current page number and can then edit the message to display the updated data.
What would be nice to have changed to make this work even better:
getCallbackDataId()
registerCallbackQueryHandler
method to the default systemCallbackqueryCommand
class. This could allow adding handlers without having to copy the command and adding it to a custom commands folder.Thoughts:
The way it is now, when on the first or last page, only 3 buttons get displayed.
Would it make sense to always display 5 if there are enough pages?
Also, what if there are 100 pages, should there be a second row of buttons for greater page jumps?
Your opinion!
Please give this a try and give me your feedback!