class Tourmaline::PaginatedKeyboard
inherits Reference
#
Convenience class for creating an InlineKeyboard
with built in pagination.
It is designed to be customizable so as not to get in your way.
Constructors#
.new(client : Tourmaline::Client, results = [] of String, per_page = 10, header = nil, footer = nil, prefix = nil, back_text = "Back", next_text = "Next", id = Helpers.random_string(8))
#
(client : Tourmaline::Client, results = [] of String, per_page = 10, header = nil, footer = nil, prefix = nil, back_text = "Back", next_text = "Next", id = Helpers.random_string(8))
Creates a new PaginatedKeyboard
.new(results = [] of String, per_page = 10, &block : self -> )
#
(results = [] of String, per_page = 10, &block : self -> )
Creates a new PaginatedKeyboard
, yielding the newly created keyboard to the block
Arguments#
results
- the initial set of resultsper_page
- the number of results to show on each pageheader
- text to be displayed above the resultsfooter
- text to be displayed below the resultsprefix
- a string to be added to the beginning of each itemback_text
- text to use for the back buttonnext_text
- text to use for the next buttonid
- an id to be used both as thegroup
name, and the prefix for the callback query data
Formatting#
The params header
, footer
, and prefix
are formatted prior to being injected into the message.
- {page}
- will be replaced with the current page number, starting at 1
- {page count}
- will be replaced with the total number of pages
- {index}
- for prefix
only, gets replaced with the index of the current item, starting at 1