music

package
v0.0.0-...-3dc37b2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearMusicQueueInteraction

func ClearMusicQueueInteraction(guildID string, author *discordgo.User, response *string)

func ClearQueueMusic

func ClearQueueMusic(s *discordgo.Session, m *discordgo.MessageCreate, input *structs.CmdInput)

ClearQueueMusic clears the queue. Does not include the current song or previus songs

func Close

func Close()

Close - clean-up for the music

func CreateMusicOverviewMessage

func CreateMusicOverviewMessage(channelID string, i interface{})

CreateMusicOverviewMessage creates the music overview message

func Initialize

func Initialize()

func MusicPrevious

func MusicPrevious(s *discordgo.Session, m *discordgo.MessageCreate, input *structs.CmdInput)

func PauseMusic

func PauseMusic(s *discordgo.Session, m *discordgo.MessageCreate, input *structs.CmdInput)

PauseMusic toggles the music from playing to pausing

func PlayMusic

func PlayMusic(s *discordgo.Session, m *discordgo.MessageCreate, input *structs.CmdInput)

Same as resume TODO: Crashes when "play" command is run multiple times before the instance has been able to initialize - invalid memory address or nil pointer dereference

func PlayMusicInteraction

func PlayMusicInteraction(guildID string, author *discordgo.User, response *string)

func PreviousSongInteraction

func PreviousSongInteraction(guildID string, author *discordgo.User, response *string)

func SkipMusic

func SkipMusic(s *discordgo.Session, m *discordgo.MessageCreate, input *structs.CmdInput)

func SongLoopInteraction

func SongLoopInteraction(guildID string, author *discordgo.User, response *string)

func StopMusic

func StopMusic(s *discordgo.Session, m *discordgo.MessageCreate, input *structs.CmdInput)

func StopMusicInteraction

func StopMusicInteraction(guildID string, author *discordgo.User, response *string)

Types

type PlaybackState

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

The variables keeping track of the playback state

type Song

type Song struct {
	ChannelID      string
	User           string // Who requested the song
	Thumbnail      string
	ChannelName    string
	Title          string
	YoutubeVideoID string
	StreamURL      string
	Duration       time.Duration
}

func (*Song) FetchStreamURL

func (s *Song) FetchStreamURL() error

func (*Song) GetDuration

func (s *Song) GetDuration() string

GetDuration returns the duration of the song

func (*Song) GetYoutubeURL

func (s *Song) GetYoutubeURL() string

GetYoutubeURL returns the full youtube url of the song

type VoiceInstance

type VoiceInstance struct {
	PlaybackState
	// contains filtered or unexported fields
}

func (*VoiceInstance) AddToQueue

func (vi *VoiceInstance) AddToQueue(s *Song)

AddToQueue - adds the song to the queue, and also prepares the song and caches it

func (*VoiceInstance) ClearQueue

func (vi *VoiceInstance) ClearQueue()

Removes all songs in the queue. Except the current song. Use 'PurgeQueue' to clear everything

func (*VoiceInstance) ClearQueueAfter

func (vi *VoiceInstance) ClearQueueAfter()

Removes all songs in the queue after the current song.

func (*VoiceInstance) ClearQueuePrev

func (vi *VoiceInstance) ClearQueuePrev()

Removes all songs in the queue before the current song.

func (*VoiceInstance) Close

func (vi *VoiceInstance) Close()

Close acts as the destructor for the object

func (*VoiceInstance) DecrementQueueIndex

func (vi *VoiceInstance) DecrementQueueIndex() bool

Returns true if the index could be decremented

func (*VoiceInstance) Disconnect

func (vi *VoiceInstance) Disconnect()

Disconnect dissconnects the bot from the voice connection

func (*VoiceInstance) FinishedPlayingSong

func (vi *VoiceInstance) FinishedPlayingSong()

Call once the song has finished playing, or you want to skip to the next song TODO: add check for if the user wants to play the song again. i.e. previous command

func (*VoiceInstance) GetFirstInQueue

func (vi *VoiceInstance) GetFirstInQueue() (*Song, error)

func (*VoiceInstance) GetGuildID

func (vi *VoiceInstance) GetGuildID() string

func (*VoiceInstance) GetMessageChannelID

func (vi *VoiceInstance) GetMessageChannelID() string

func (*VoiceInstance) GetMessageID

func (vi *VoiceInstance) GetMessageID() string

func (*VoiceInstance) GetQueueIndex

func (vi *VoiceInstance) GetQueueIndex() int

func (*VoiceInstance) GetQueueLength

func (vi *VoiceInstance) GetQueueLength() int

func (*VoiceInstance) GetQueueLengthRelative

func (vi *VoiceInstance) GetQueueLengthRelative() int

Takes into account the current queue index

func (*VoiceInstance) GetSongByIndex

func (vi *VoiceInstance) GetSongByIndex(i int) *Song

Returns the song from the queue with the given index

func (*VoiceInstance) IncrementQueueIndex

func (vi *VoiceInstance) IncrementQueueIndex() bool

TODO: When at the end of queue. Should increment one more

func (*VoiceInstance) IsLoading

func (vi *VoiceInstance) IsLoading() bool

func (*VoiceInstance) IsLooping

func (vi *VoiceInstance) IsLooping() bool

func (*VoiceInstance) IsPlaying

func (vi *VoiceInstance) IsPlaying() bool

func (*VoiceInstance) IsStartOfQueue

func (vi *VoiceInstance) IsStartOfQueue() bool

func (*VoiceInstance) New

func (vi *VoiceInstance) New(guildID string) error

New creates a new VoiceInstance. Remember to call 'vi.Close()' before deleting the object

func (*VoiceInstance) PauseToggle

func (vi *VoiceInstance) PauseToggle()

Toggles between play and pause

func (*VoiceInstance) PlayQueue

func (vi *VoiceInstance) PlayQueue()

Plays the Queue

func (*VoiceInstance) Prev

func (vi *VoiceInstance) Prev() bool

Prev will go back to the previous song. If there is no song to go back to so will the song be restarted Running this command, if nothing is playing, should start playing the song

func (*VoiceInstance) PurgeQueue

func (vi *VoiceInstance) PurgeQueue()

Purges the queue

func (*VoiceInstance) QueueIsEmpty

func (vi *VoiceInstance) QueueIsEmpty() bool

func (*VoiceInstance) SetMessageChannelID

func (vi *VoiceInstance) SetMessageChannelID(id string)

func (*VoiceInstance) SetMessageID

func (vi *VoiceInstance) SetMessageID(id string)

func (*VoiceInstance) Skip

func (vi *VoiceInstance) Skip() bool

Skip skipps the song. returns true of success, else false Will also disable looping (if enabled)

func (*VoiceInstance) Stop

func (vi *VoiceInstance) Stop() bool

Stops the current song and clears the queue. returns true of success, else false

func (*VoiceInstance) StreamAudioToVoiceChannel

func (vi *VoiceInstance) StreamAudioToVoiceChannel() error

func (*VoiceInstance) ToggleLooping

func (vi *VoiceInstance) ToggleLooping()

Jump to

Keyboard shortcuts

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