Documentation
¶
Index ¶
- Variables
- func NewEventCollector[E any](session *discordgo.Session, filterFunc func(s *discordgo.Session, e E) bool) (<-chan E, func())
- func WaitForEvent[E any](session *discordgo.Session, ctx context.Context, ...)
- type ButtonsConfig
- type ComponentOptions
- type Config
- type ConfigOpt
- type Manager
- func (m *Manager) CreateInteraction(s *discordgo.Session, interaction *discordgo.Interaction, paginator *Paginator, ...) error
- func (m *Manager) CreateMessage(s *discordgo.Session, channelID string, paginator *Paginator) error
- func (m *Manager) OnInteractionCreate(s *discordgo.Session, interaction *discordgo.InteractionCreate)
- type Paginator
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = Config{ ButtonsConfig: ButtonsConfig{ First: &ComponentOptions{ Emoji: discordgo.ComponentEmoji{ Name: "⏮", }, Style: discordgo.PrimaryButton, }, Back: &ComponentOptions{ Emoji: discordgo.ComponentEmoji{ Name: "◀", }, Style: discordgo.PrimaryButton, }, Stop: &ComponentOptions{ Emoji: discordgo.ComponentEmoji{ Name: "🗑", }, Style: discordgo.DangerButton, }, Next: &ComponentOptions{ Emoji: discordgo.ComponentEmoji{ Name: "▶", }, Style: discordgo.PrimaryButton, }, Last: &ComponentOptions{ Emoji: discordgo.ComponentEmoji{ Name: "⏩", }, Style: discordgo.PrimaryButton, }, }, NotYourPaginatorMessage: "You can't interact with this paginator because it's not yours.", CustomIDPrefix: "paginator", EmbedColor: 0x4c50c1, }
Functions ¶
func NewEventCollector ¶
func NewEventCollector[E any](session *discordgo.Session, filterFunc func(s *discordgo.Session, e E) bool) (<-chan E, func())
NewEventCollector returns a channel in which the events of type T gets sent which pass the passed filter and a function which can be used to stop the event collector. The close function needs to be called to stop the event collector.
func WaitForEvent ¶
func WaitForEvent[E any](session *discordgo.Session, ctx context.Context, filterFunc func(s *discordgo.Session, e E) bool, actionFunc func(s *discordgo.Session, e E), cancelFunc func())
WaitForEvent waits for an event passing the filterFunc and then calls the actionFunc. You can cancel this function with the passed context.Context and the cancelFunc gets called then.
Types ¶
type ButtonsConfig ¶
type ButtonsConfig struct { First *ComponentOptions Back *ComponentOptions Stop *ComponentOptions Next *ComponentOptions Last *ComponentOptions }
type ComponentOptions ¶
type ComponentOptions struct { Emoji discordgo.ComponentEmoji Label string Style discordgo.ButtonStyle }
type Config ¶
type Config struct { ButtonsConfig ButtonsConfig NotYourPaginatorMessage string CustomIDPrefix string EmbedColor int }
type ConfigOpt ¶
type ConfigOpt func(config *Config)
func WithButtonsConfig ¶
func WithButtonsConfig(buttonsConfig ButtonsConfig) ConfigOpt
func WithCustomIDPrefix ¶
func WithEmbedColor ¶
type Manager ¶
type Manager struct { Config Config // contains filtered or unexported fields }
func NewManager ¶
func (*Manager) CreateInteraction ¶
func (*Manager) CreateMessage ¶
func (*Manager) OnInteractionCreate ¶
func (m *Manager) OnInteractionCreate(s *discordgo.Session, interaction *discordgo.InteractionCreate)
Click to show internal directories.
Click to hide internal directories.