paginatedmessages

package
v2.49.3 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 11 Imported by: 10

Documentation

Index

Constants

View Source
const (
	EmojiNext = "▶"
	EmojiPrev = "◀"
)

Variables

View Source
var ErrNoResults = errors.New("no results")

Functions

func PaginatedCommand

func PaginatedCommand(pageArgIndex int, cb PaginatedCommandFunc) dcmd.RunFunc

func RegisterPlugin

func RegisterPlugin()

Types

type CtxKey

type CtxKey int
const CtxKeyNoPagination CtxKey = 1

type PagerFunc

type PagerFunc func(p *PaginatedMessage, page int) (*discordgo.MessageEmbed, error)

type PaginatedCommandFunc

type PaginatedCommandFunc func(data *dcmd.Data, p *PaginatedMessage, page int) (*discordgo.MessageEmbed, error)

type PaginatedMessage

type PaginatedMessage struct {
	// immutable fields, safe to access without a lock, don't write to these, i dont see why you would need to either...
	MessageID int64
	ChannelID int64
	GuildID   int64

	// mutable fields
	CurrentPage  int
	MaxPage      int
	LastResponse *discordgo.MessageEmbed
	Navigate     func(p *PaginatedMessage, newPage int) (*discordgo.MessageEmbed, error)
	Broken       bool
	// contains filtered or unexported fields
}

func (*PaginatedMessage) HandlePageButtonClick added in v2.3.0

func (p *PaginatedMessage) HandlePageButtonClick(ic *discordgo.InteractionCreate, pageMod int)

func (*PaginatedMessage) Stop

func (p *PaginatedMessage) Stop()

type PaginatedResponse added in v2.40.0

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

func NewPaginatedResponse added in v2.40.0

func NewPaginatedResponse(guildID, channelID int64, initPage, maxPages int, pagerFunc PagerFunc) *PaginatedResponse

func (*PaginatedResponse) Send added in v2.40.0

func (p *PaginatedResponse) Send(data *dcmd.Data) ([]*discordgo.Message, error)

type Plugin

type Plugin struct{}

func (*Plugin) BotInit

func (p *Plugin) BotInit()

func (*Plugin) PluginInfo

func (p *Plugin) PluginInfo() *common.PluginInfo

func (*Plugin) StopBot

func (p *Plugin) StopBot(wg *sync.WaitGroup)

Jump to

Keyboard shortcuts

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