Documentation
¶
Index ¶
- func ClearMusicQueueInteraction(guildID string, author *discordgo.User, response *string)
- func ClearQueueMusic(s *discordgo.Session, m *discordgo.MessageCreate, input *structs.CmdInput)
- func Close()
- func CreateMusicOverviewMessage(channelID string, i interface{})
- func Initialize()
- func MusicPrevious(s *discordgo.Session, m *discordgo.MessageCreate, input *structs.CmdInput)
- func PauseMusic(s *discordgo.Session, m *discordgo.MessageCreate, input *structs.CmdInput)
- func PlayMusic(s *discordgo.Session, m *discordgo.MessageCreate, input *structs.CmdInput)
- func PlayMusicInteraction(guildID string, author *discordgo.User, response *string)
- func PreviousSongInteraction(guildID string, author *discordgo.User, response *string)
- func SkipMusic(s *discordgo.Session, m *discordgo.MessageCreate, input *structs.CmdInput)
- func SongLoopInteraction(guildID string, author *discordgo.User, response *string)
- func StopMusic(s *discordgo.Session, m *discordgo.MessageCreate, input *structs.CmdInput)
- func StopMusicInteraction(guildID string, author *discordgo.User, response *string)
- type PlaybackState
- type Song
- type VoiceInstance
- func (vi *VoiceInstance) AddToQueue(s *Song)
- func (vi *VoiceInstance) ClearQueue()
- func (vi *VoiceInstance) ClearQueueAfter()
- func (vi *VoiceInstance) ClearQueuePrev()
- func (vi *VoiceInstance) Close()
- func (vi *VoiceInstance) DecrementQueueIndex() bool
- func (vi *VoiceInstance) Disconnect()
- func (vi *VoiceInstance) FinishedPlayingSong()
- func (vi *VoiceInstance) GetFirstInQueue() (*Song, error)
- func (vi *VoiceInstance) GetGuildID() string
- func (vi *VoiceInstance) GetMessageChannelID() string
- func (vi *VoiceInstance) GetMessageID() string
- func (vi *VoiceInstance) GetQueueIndex() int
- func (vi *VoiceInstance) GetQueueLength() int
- func (vi *VoiceInstance) GetQueueLengthRelative() int
- func (vi *VoiceInstance) GetSongByIndex(i int) *Song
- func (vi *VoiceInstance) IncrementQueueIndex() bool
- func (vi *VoiceInstance) IsLoading() bool
- func (vi *VoiceInstance) IsLooping() bool
- func (vi *VoiceInstance) IsPlaying() bool
- func (vi *VoiceInstance) IsStartOfQueue() bool
- func (vi *VoiceInstance) New(guildID string) error
- func (vi *VoiceInstance) PauseToggle()
- func (vi *VoiceInstance) PlayQueue()
- func (vi *VoiceInstance) Prev() bool
- func (vi *VoiceInstance) PurgeQueue()
- func (vi *VoiceInstance) QueueIsEmpty() bool
- func (vi *VoiceInstance) SetMessageChannelID(id string)
- func (vi *VoiceInstance) SetMessageID(id string)
- func (vi *VoiceInstance) Skip() bool
- func (vi *VoiceInstance) Stop() bool
- func (vi *VoiceInstance) StreamAudioToVoiceChannel() error
- func (vi *VoiceInstance) ToggleLooping()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearQueueMusic ¶
ClearQueueMusic clears the queue. Does not include the current song or previus songs
func CreateMusicOverviewMessage ¶
func CreateMusicOverviewMessage(channelID string, i interface{})
CreateMusicOverviewMessage creates the music overview message
func Initialize ¶
func Initialize()
func MusicPrevious ¶
func PauseMusic ¶
PauseMusic toggles the music from playing to pausing
func PlayMusic ¶
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 PreviousSongInteraction ¶
func SongLoopInteraction ¶
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 (*Song) GetDuration ¶
GetDuration returns the duration of the song
func (*Song) GetYoutubeURL ¶
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) 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) 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()