music

package
v0.0.0-...-4014866 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetModule

func GetModule() *snorlax.Module

GetModule returns the music module.

Types

type Connection

type Connection struct {
	GuildID         string
	ChannelID       string
	EncodeOpts      *dca.EncodeOptions
	VoiceConnection *discordgo.VoiceConnection
	Queue           []*QueueItem
	Mutex           *sync.Mutex
}

Connection is the type for a music connection to Discord.

func NewConnection

func NewConnection(voice *discordgo.VoiceConnection, opts *dca.EncodeOptions) *Connection

NewConnection will return a new Connection struct.

func (*Connection) AddYouTubeVideo

func (c *Connection) AddYouTubeVideo(url string) (*ytdl.VideoInfo, error)

AddYouTubeVideo will add the download URL for a YouTube video to the queue.

func (*Connection) Close

func (c *Connection) Close() error

Close closes the VoiceConnection, stops sending speaking packet, and closes the EncodeSession.

func (*Connection) StreamMusic

func (c *Connection) StreamMusic() error

StreamMusic will create a new encode session from the current DownloadURL and stream that to the VoiceConnection. Will block until queue is empty.

type QueueItem

type QueueItem struct {
	Info *ytdl.VideoInfo
	URL  *url.URL
}

QueueItem is the item used for the queue.

Jump to

Keyboard shortcuts

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