Documentation
¶
Index ¶
- type ButtonsConfig
- type ComponentOption
- type ConfigOpt
- func WithButtonsConfig(buttonsConfig ButtonsConfig) ConfigOpt
- func WithCustomIDPrefix(prefix string) ConfigOpt
- func WithDiscordConfig(discordConfig DiscordConfig) ConfigOpt
- func WithEmbedColor(color int) ConfigOpt
- func WithIdleWait(idleWait time.Duration) ConfigOpt
- func WithItemsPerPage(itemsPerPage int) ConfigOpt
- type DiscordConfig
- type Paginator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ButtonsConfig ¶
type ButtonsConfig struct {
First *ComponentOption
Back *ComponentOption
Stop *ComponentOption
Next *ComponentOption
Last *ComponentOption
}
ButtonsConfig is the configuration for the pagination buttons.
type ComponentOption ¶
type ComponentOption struct {
Emoji *discordgo.ComponentEmoji
Label string
Style discordgo.ButtonStyle
}
ComponentOption are the options used to create a pagination button.
type ConfigOpt ¶
type ConfigOpt func(config *config)
ConfigOpt is a function that can be used to modify the paginator's configuration.
func WithButtonsConfig ¶
func WithButtonsConfig(buttonsConfig ButtonsConfig) ConfigOpt
WithButtonsConfig sets the button configuration for the paginator.
func WithCustomIDPrefix ¶
WithCustomIDPrefix sets the custom ID prefix for the paginator.
func WithDiscordConfig ¶
func WithDiscordConfig(discordConfig DiscordConfig) ConfigOpt
WithDiscordConfig sets the Discord configuration for the paginator.
func WithEmbedColor ¶
WithEmbedColor sets the embed color for the paginator.
func WithIdleWait ¶
WithIdleWait sets the idle wait time for the paginator.
func WithItemsPerPage ¶
WithItemsPerPage sets the default number of items per page for the paginator.
type DiscordConfig ¶
type DiscordConfig struct {
Session *discordgo.Session
AddComponentHandler func(key string, handler func(*discordgo.Session, *discordgo.InteractionCreate))
RemoveComponentHandler func(key string)
}
DiscordConfig is the configuration used by the paginator when using Discord.
type Paginator ¶
type Paginator struct {
// contains filtered or unexported fields
}
Paginator represents a paginator that may be used to create paginated messages on a Discord server.
func NewPaginator ¶
NewPaginator creates a new paginator.
func (*Paginator) Close ¶
func (p *Paginator) Close()
Close closes the paginator and disables all paginated messages
func (*Paginator) CreateInteractionResponse ¶
func (p *Paginator) CreateInteractionResponse(s *discordgo.Session, i *discordgo.InteractionCreate, title string, embedFields []*discordgo.MessageEmbedField, ephemeral ...bool) error
createInteractionResponse creates and sends a message with the paginator's content.