disgopage

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2025 License: GPL-3.0 Imports: 6 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

func WithCustomIDPrefix(prefix string) ConfigOpt

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

func WithEmbedColor(color int) ConfigOpt

WithEmbedColor sets the embed color for the paginator.

func WithIdleWait

func WithIdleWait(idleWait time.Duration) ConfigOpt

WithIdleWait sets the idle wait time for the paginator.

func WithItemsPerPage

func WithItemsPerPage(itemsPerPage int) ConfigOpt

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

func NewPaginator(opts ...ConfigOpt) *Paginator

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.

func (*Paginator) CreateMessage added in v0.2.0

func (p *Paginator) CreateMessage(s *discordgo.Session, channelID string, title string, embedFields []*discordgo.MessageEmbedField) error

createInteractionResponse creates and sends a message with the paginator's content.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL