notification

package
v0.0.0-...-2e76f4a Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notification

type Notification int8
const (
	// NewSongs notification for a new song added to the queue
	NewSongs Notification = iota
	// Skip notification for a song being skipped
	Skip
	// Pause notification for a song being paused
	Pause
	// Resume notification for a song being resumed
	Resume
	// Clear notification for the queue being cleared
	Clear
	// Finished notification for the queue being finished
	Finished
	// Playing notification for a song starting to play
	Playing
	// PrioritySong notification for a song being added to the queue with priority
	PrioritySong
	// LoopFinished notification for a song finishing a loop
	LoopFinished
)

type NotificationMessage

type NotificationMessage struct {
	Notification Notification    `json:"notification"`
	Songs        []queue.Element `json:"song,omitempty"`
	Guild        string          `json:"-"`
}

type Notifier

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

func NewNotifier

func NewNotifier() *Notifier

NewNotifier creates a new notifier instance

func (*Notifier) AddChannel

func (n *Notifier) AddChannel(channel chan<- NotificationMessage, guild string)

AddChannel adds a channel to the notifier for the given guild

func (*Notifier) Notify

func (n *Notifier) Notify(guild string, message NotificationMessage)

Notify sends a notification to all channels in the notifier for the given guild (if any)

func (*Notifier) RemoveChannel

func (n *Notifier) RemoveChannel(channel chan<- NotificationMessage, guild string) bool

RemoveChannel removes a channel from the notifier, closing it in the process and returning true if it was found

Jump to

Keyboard shortcuts

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