paginator

package module
v0.0.0-...-2474e39 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 8 Imported by: 2

README

paginator

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ButtonsConfig

type ButtonsConfig struct {
	First *ComponentOptions
	Back  *ComponentOptions
	Stop  *ComponentOptions
	Next  *ComponentOptions
	Last  *ComponentOptions
}

type ComponentOptions

type ComponentOptions struct {
	Emoji discord.ComponentEmoji
	Label string
	Style discord.ButtonStyle
}

type Config

type Config struct {
	ButtonsConfig       ButtonsConfig
	NoPermissionMessage string
	CustomIDPrefix      string
	EmbedColor          int
	CleanupInterval     time.Duration
	Timeout             time.Duration
}

func DefaultConfig

func DefaultConfig() *Config

func (*Config) Apply

func (c *Config) Apply(opts []ConfigOpt)

type ConfigOpt

type ConfigOpt func(config *Config)

func WithButtonsConfig

func WithButtonsConfig(buttonsConfig ButtonsConfig) ConfigOpt

func WithCleanupInterval

func WithCleanupInterval(cleanupInterval time.Duration) ConfigOpt

func WithCustomIDPrefix

func WithCustomIDPrefix(prefix string) ConfigOpt

func WithEmbedColor

func WithEmbedColor(color int) ConfigOpt

func WithNoPermissionMessage

func WithNoPermissionMessage(noPermissionMessage string) ConfigOpt

func WithTimeout

func WithTimeout(timeout time.Duration) ConfigOpt

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(opts ...ConfigOpt) *Manager

func (*Manager) Create

func (m *Manager) Create(responderFunc events.InteractionResponderFunc, paginator *Paginator) error

func (*Manager) OnEvent

func (m *Manager) OnEvent(event bot.Event)

func (*Manager) Update

func (m *Manager) Update(responderFunc events.InteractionResponderFunc, paginator *Paginator) error

type Paginator

type Paginator struct {
	PageFunc        func(page int, embed *discord.EmbedBuilder)
	MaxPages        int
	Creator         snowflake.ID
	ExpiryLastUsage bool

	ID        string
	Ephemeral bool
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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