Documentation
¶
Index ¶
- func MinMax(array []float64) (float64, float64)
- type PlaySession
- type Player
- func (p *Player) Connect() error
- func (p *Player) Disconnect() error
- func (p *Player) GenerateNowPlayingEmbed(short bool) *discordgo.MessageEmbed
- func (p *Player) GeneratePlayerString(dur time.Duration) string
- func (p *Player) Kill()
- func (p *Player) Pause()
- func (p *Player) Paused() bool
- func (p *Player) Play()
- func (p *Player) Playing() bool
- func (p *Player) Read(url string) error
- func (p *Player) Resume()
- func (p *Player) SendNotice(title, body, footer string)
- func (p *Player) SetVolume(v int) error
- func (p *Player) SetVolumePercent(v int) error
- func (p *Player) Skip()
- func (p *Player) Stop()
- func (p *Player) Stopped() bool
- func (p *Player) UpdateConf(gc *models.Conf)
- func (p *Player) Volume() int
- type Players
- type Queue
- func (q *Queue) Append(t ...tracks.Track)
- func (q *Queue) Clear()
- func (q *Queue) Duration() int
- func (q *Queue) DurationString() string
- func (q *Queue) GenerateQueueEmbed() *discordgo.MessageEmbed
- func (q *Queue) Get() tracks.Track
- func (q *Queue) Len() int
- func (q *Queue) Loop()
- func (q *Queue) Pop()
- func (q *Queue) Prepend(t ...tracks.Track)
- func (q *Queue) RemoveN(n int)
- func (q *Queue) Shuffle()
- type State
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PlaySession ¶
type PlaySession struct { }
type Player ¶
type Player struct { Queue *Queue Guild string Conf *models.Conf Storage *storage.BoltStorage Stats *Stats // contains filtered or unexported fields }
Player is the struct in charge of connecting to voice channels and streaming tracks to them.
func NewPlayer ¶
func NewPlayer(s *discordgo.Session, conf *cmd.Conf, log zerolog.Logger, guildID string, storage *storage.BoltStorage, gc *models.Conf) (*Player, error)
NewPlayer will create a new player from scratch using the provided arguments
func (*Player) Disconnect ¶
Disconnect will disconnect the player from the currently connected voice channel if any.
func (*Player) GenerateNowPlayingEmbed ¶
func (p *Player) GenerateNowPlayingEmbed(short bool) *discordgo.MessageEmbed
func (*Player) GeneratePlayerString ¶
func (*Player) SendNotice ¶
func (*Player) SetVolumePercent ¶
func (*Player) UpdateConf ¶
type Players ¶
Players will hold the guild players
func (*Players) Create ¶
func (p *Players) Create(s *discordgo.Session, conf *cmd.Conf, log zerolog.Logger, guild string, storage *storage.BoltStorage, gc *models.Conf) error
Create will create a new player and associate it with the guild
type Queue ¶
func (*Queue) Clear ¶
func (q *Queue) Clear()
Clear will reset the queue, removing all tracks from it except the first one if it is currently played.
func (*Queue) DurationString ¶
DurationString will return the total duration of the active queue in human readable format.
func (*Queue) GenerateQueueEmbed ¶
func (q *Queue) GenerateQueueEmbed() *discordgo.MessageEmbed
func (*Queue) Get ¶
Get will return the first track in queue if any. If there is no track in queue, nil will be returned.
func (*Queue) Loop ¶
func (q *Queue) Loop()
Loop will move the first track at the end of the queue if there is more than one track in queue. Otherwise it does nothing, leaving the first track in its position to be played once more.
func (*Queue) Prepend ¶
Prepend will add tracks to the start of the queue, either right after the currently playing track, or right at the start if the player is stopped.