music

package
v0.0.0-...-168ccef Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const COOLDOWNTIME = 10

Variables

View Source
var (
	ServerConnections = Connections{ConnectionMap: make(map[string]*Connection)}
	UserJoinError     = errors.New("you are not in a voice channel")
	Client            = http.Client{Timeout: time.Second * 10}
)

MusicConnections maps a Guild ID to an associated voice connection.

Functions

func AddToQueue

func AddToQueue(ctx *exrouter.Context)

func AddToQueueYT

func AddToQueueYT(ctx *exrouter.Context)

func CreateVoiceConnection

func CreateVoiceConnection(ctx *exrouter.Context, guild *discordgo.Guild, conn *Connection) (*discordgo.VoiceConnection, error)

func Play

func Play(ctx *exrouter.Context, conn *Connection, vc *discordgo.VoiceConnection)

Types

type Connection

type Connection struct {
	*sync.RWMutex
	VoiceChannelID   string
	MsgChannelID     string
	Playing          bool
	Done             chan error
	Queue            *list.List
	VoiceConnection  *discordgo.VoiceConnection
	StreamingSession *dca.StreamingSession
	LastInvoke       time.Time
}

func (*Connection) AddYouTubeVideo

func (c *Connection) AddYouTubeVideo(song *SongResponse)

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

func (*Connection) YoutubeCleanup

func (c *Connection) YoutubeCleanup()

type Connections

type Connections struct {
	*sync.RWMutex
	ConnectionMap map[string]*Connection
}

type PlaylistResponse

type PlaylistResponse struct {
	Title string `json:"title"`
	URL   string `json:"url"`
}

type QUERYTYPE

type QUERYTYPE int

Query type enum

const (
	ERRORTYPE QUERYTYPE = iota
	SONGTYPE
	PLAYLISTTYPE
)

type SongResponse

type SongResponse struct {
	URL        string      `json:"url"`
	UploadDate null.String `json:"upload_date"`
	Duration   null.Float  `json:"duration"`
	Thumbnail  string      `json:"thumbnail"`
	Title      string      `json:"title"`
}

type Youtube

type Youtube struct{}

Empty youtube receiver

func (Youtube) GetPlaylist

func (youtube Youtube) GetPlaylist(input string) (*[]PlaylistResponse, error)

func (Youtube) GetSong

func (youtube Youtube) GetSong(input string) (*SongResponse, error)
func (youtube Youtube) YoutubeDLLink(input string) (QUERYTYPE, *string, error)

func (Youtube) YoutubeDLQuery

func (youtube Youtube) YoutubeDLQuery(input string) (QUERYTYPE, *string, error)

Jump to

Keyboard shortcuts

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