paginator

package module
v0.0.0-...-3de5c2d Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

README

paginator

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	ButtonsConfig: ButtonsConfig{
		First: &ComponentOptions{
			Emoji: discord.ComponentEmoji{
				Name: "⏮",
			},
			Style: discord.ButtonStylePrimary,
		},
		Back: &ComponentOptions{
			Emoji: discord.ComponentEmoji{
				Name: "◀",
			},
			Style: discord.ButtonStylePrimary,
		},
		Stop: &ComponentOptions{
			Emoji: discord.ComponentEmoji{
				Name: "🗑",
			},
			Style: discord.ButtonStyleDanger,
		},
		Next: &ComponentOptions{
			Emoji: discord.ComponentEmoji{
				Name: "▶",
			},
			Style: discord.ButtonStylePrimary,
		},
		Last: &ComponentOptions{
			Emoji: discord.ComponentEmoji{
				Name: "⏩",
			},
			Style: discord.ButtonStylePrimary,
		},
	},
	NoPermissionMessage: "You can't interact with this paginator because it's not yours.",
	CustomIDPrefix:      "paginator",
	EmbedColor:          0x4c50c1,
}

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
}

func (*Config) Apply

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

type ConfigOpt

type ConfigOpt func(config *Config)

func WithButtonsConfig

func WithButtonsConfig(buttonsConfig ButtonsConfig) ConfigOpt

func WithCustomIDPrefix

func WithCustomIDPrefix(prefix string) ConfigOpt

func WithEmbedColor

func WithEmbedColor(color int) ConfigOpt

func WithNoPermissionMessage

func WithNoPermissionMessage(noPermissionMessage string) 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(interaction core.CreateInteraction, paginator *Paginator) error

func (*Manager) OnEvent

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

type Paginator

type Paginator struct {
	PageFunc        func(page int, embed *discord.EmbedBuilder)
	MaxPages        int
	Creator         snowflake.Snowflake
	ExpiryLastUsage bool
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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