Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeProbeInfo(r io.Reader) (string, error)
- func EncodeProbeInfo(probeInfo string, w io.Writer) error
- func EncodeToString(track AudioTrack, customTrackEncoder CustomTrackEncoder) (str string, err error)
- func ReadBool(r io.Reader) (b bool, err error)
- func ReadInt16(r io.Reader) (i int16, err error)
- func ReadInt32(r io.Reader) (i int32, err error)
- func ReadInt64(r io.Reader) (i int64, err error)
- func ReadNullableString(r io.Reader) (*string, error)
- func ReadString(r io.Reader) (string, error)
- func ReadUInt8(r io.Reader) (i uint8, err error)
- func UserIDFromBotToken(token string) (snowflake.ID, error)
- func WriteBool(w io.Writer, bool bool) error
- func WriteInt16(w io.Writer, i int16) error
- func WriteInt32(w io.Writer, i int32) error
- func WriteInt64(w io.Writer, i int64) error
- func WriteInt8(w io.Writer, i int8) error
- func WriteNullableString(w io.Writer, str *string) error
- func WriteString(w io.Writer, str string) error
- type AudioLoadResultHandler
- type AudioPlaylist
- type AudioTrack
- type AudioTrackEndReason
- type AudioTrackInfo
- type BasicAudioPlaylist
- type BasicAudioTrack
- type CPU
- type Config
- type ConfigOpt
- func WithHTTPClient(httpClient *http.Client) ConfigOpt
- func WithLogger(logger log.Logger) ConfigOpt
- func WithOverwritePlugins(plugins ...any) ConfigOpt
- func WithPlugins(plugins ...any) ConfigOpt
- func WithUserID(userID snowflake.ID) ConfigOpt
- func WithUserIDFromBotToken(botToken string) ConfigOpt
- func WithUserIDString(userID string) ConfigOpt
- type ConfigureResumingCommand
- type CustomTrackEncoder
- type CustomTrackInfoDecoder
- type DefaultFilters
- func (f *DefaultFilters) Clear() Filters
- func (f *DefaultFilters) Commit() error
- func (f *DefaultFilters) Distortion() *Distortion
- func (f *DefaultFilters) Equalizer() *Equalizer
- func (f *DefaultFilters) Karaoke() *Karaoke
- func (f *DefaultFilters) Rotation() *Rotation
- func (f *DefaultFilters) SetDistortion(distortion *Distortion) Filters
- func (f *DefaultFilters) SetEqualizer(equalizer *Equalizer) Filters
- func (f *DefaultFilters) SetKaraoke(karaoke *Karaoke) Filters
- func (f *DefaultFilters) SetRotation(rotation *Rotation) Filters
- func (f *DefaultFilters) SetTimescale(timescale *Timescale) Filters
- func (f *DefaultFilters) SetTremolo(tremolo *Tremolo) Filters
- func (f *DefaultFilters) SetVibrato(vibrato *Vibrato) Filters
- func (f *DefaultFilters) SetVolume(volume *Volume) Filters
- func (f *DefaultFilters) Timescale() *Timescale
- func (f *DefaultFilters) Tremolo() *Tremolo
- func (f *DefaultFilters) Vibrato() *Vibrato
- func (f *DefaultFilters) Volume() *Volume
- type DefaultPlayer
- func (p *DefaultPlayer) AddListener(listener any)
- func (p *DefaultPlayer) ChangeNode(node Node)
- func (p *DefaultPlayer) ChannelID() *snowflake.ID
- func (p *DefaultPlayer) Connected() bool
- func (p *DefaultPlayer) Destroy() error
- func (p *DefaultPlayer) EmitEvent(caller func(l any))
- func (p *DefaultPlayer) Export() PlayerRestoreState
- func (p *DefaultPlayer) Filters() Filters
- func (p *DefaultPlayer) GuildID() snowflake.ID
- func (p *DefaultPlayer) Node() Node
- func (p *DefaultPlayer) OnEvent(event TrackEvent)
- func (p *DefaultPlayer) OnPlayerUpdate(state PlayerState)
- func (p *DefaultPlayer) OnVoiceServerUpdate(voiceServerUpdate VoiceServerUpdate)
- func (p *DefaultPlayer) OnVoiceStateUpdate(voiceStateUpdate VoiceStateUpdate)
- func (p *DefaultPlayer) Pause(pause bool) error
- func (p *DefaultPlayer) Paused() bool
- func (p *DefaultPlayer) Play(track AudioTrack) error
- func (p *DefaultPlayer) PlayAt(track AudioTrack, start Duration, end Duration) error
- func (p *DefaultPlayer) PlayTrack(track AudioTrack, options PlayOptions) error
- func (p *DefaultPlayer) PlayingTrack() AudioTrack
- func (p *DefaultPlayer) Position() Duration
- func (p *DefaultPlayer) RemoveListener(listener any)
- func (p *DefaultPlayer) Seek(position Duration) error
- func (p *DefaultPlayer) SetFilters(filters Filters)
- func (p *DefaultPlayer) SetVolume(volume int) error
- func (p *DefaultPlayer) Stop() error
- func (p *DefaultPlayer) Volume() int
- type DestroyCommand
- type Distortion
- type Duration
- func (d Duration) Days() int64
- func (d Duration) Hours() int64
- func (d Duration) HoursPart() int64
- func (d Duration) Milliseconds() int64
- func (d Duration) MillisecondsPart() int64
- func (d Duration) Minutes() int64
- func (d Duration) MinutesPart() int64
- func (d Duration) Seconds() int64
- func (d Duration) SecondsPart() int64
- func (d Duration) String() string
- type EqBand
- type Equalizer
- type EventPlugin
- type EventPlugins
- type EventType
- type Filters
- type FiltersCommand
- type FrameStats
- type FriendlyException
- type FunctionalResultHandler
- func (h FunctionalResultHandler) LoadFailed(e FriendlyException)
- func (h FunctionalResultHandler) NoMatches()
- func (h FunctionalResultHandler) PlaylistLoaded(playlist AudioPlaylist)
- func (h FunctionalResultHandler) SearchResultLoaded(tracks []AudioTrack)
- func (h FunctionalResultHandler) TrackLoaded(track AudioTrack)
- type HTTPAudioTrack
- type HTTPSourcePlugin
- type Karaoke
- type Lavalink
- type LoadResult
- type LoadType
- type LocalAudioTrack
- type LocalSourcePlugin
- type Memory
- type Node
- type NodeConfig
- type NodeStatus
- type Op
- type OpCommand
- type OpEvent
- type OpPlugin
- type OpPlugins
- type OpType
- type PauseCommand
- type PlayCommand
- type PlayOptions
- type Player
- type PlayerEventAdapter
- func (a PlayerEventAdapter) OnPlayerPause(player Player)
- func (a PlayerEventAdapter) OnPlayerResume(player Player)
- func (a PlayerEventAdapter) OnPlayerUpdate(player Player, state PlayerState)
- func (a PlayerEventAdapter) OnTrackEnd(player Player, track AudioTrack, endReason AudioTrackEndReason)
- func (a PlayerEventAdapter) OnTrackException(player Player, track AudioTrack, exception FriendlyException)
- func (a PlayerEventAdapter) OnTrackStart(player Player, track AudioTrack)
- func (a PlayerEventAdapter) OnTrackStuck(player Player, track AudioTrack, thresholdMs Duration)
- func (a PlayerEventAdapter) OnWebSocketClosed(player Player, code int, reason string, byRemote bool)
- type PlayerEventListener
- type PlayerRestoreState
- type PlayerState
- type PlayerUpdateOp
- type PlaylistInfo
- type Plugin
- type PluginEventAdapter
- func (a PluginEventAdapter) OnDestroyPlayer(player Player)
- func (a PluginEventAdapter) OnNewPlayer(player Player)
- func (a PluginEventAdapter) OnNodeDestroy(node Node)
- func (a PluginEventAdapter) OnNodeMessageIn(node Node, data []byte)
- func (a PluginEventAdapter) OnNodeMessageOut(node Node, data []byte)
- func (a PluginEventAdapter) OnNodeOpen(node Node)
- type PluginEventHandler
- type RestAudioTrack
- type RestClient
- type Rotation
- type SearchType
- type SeekCommand
- type Severity
- type SourcePlugin
- type Stats
- type StatsOp
- type StopCommand
- type Time
- type Timescale
- type TrackEndEvent
- type TrackEvent
- type TrackExceptionEvent
- type TrackStartEvent
- type TrackStuckEvent
- type Tremolo
- type UnknownEvent
- type UnknownOp
- type UnmarshalOp
- type UnmarshalOpEvent
- type Vibrato
- type VoiceServerUpdate
- type VoiceStateUpdate
- type VoiceUpdateCommand
- type Volume
- type VolumeCommand
- type WebsocketClosedEvent
Constants ¶
View Source
const ( Millisecond Duration = 1 Second = 1000 * Millisecond Minute = 60 * Second Hour = 60 * Minute Day = 24 * Hour )
View Source
const ( Name = "disgolink" GitHub = "https://github.com/disgoorg/" + Name )
Variables ¶
View Source
var ErrInvalidBotToken = errors.New("invalid bot token")
View Source
var ErrNoUserID = errors.New("no user id has been configured")
View Source
var UnmarshalFilters = func(data []byte) (Filters, error) { var filters *DefaultFilters if err := json.Unmarshal(data, &filters); err != nil { return nil, fmt.Errorf("error while unmarshalling filters: %w", err) } return filters, nil }
View Source
var (
Version = getVersion()
)
Functions ¶
func EncodeToString ¶
func EncodeToString(track AudioTrack, customTrackEncoder CustomTrackEncoder) (str string, err error)
func UserIDFromBotToken ¶
Types ¶
type AudioLoadResultHandler ¶
type AudioLoadResultHandler interface { TrackLoaded(track AudioTrack) PlaylistLoaded(playlist AudioPlaylist) SearchResultLoaded(tracks []AudioTrack) NoMatches() LoadFailed(e FriendlyException) }
func NewResultHandler ¶
func NewResultHandler(trackLoaded func(track AudioTrack), playlistLoaded func(playlist AudioPlaylist), searchResultLoaded func(tracks []AudioTrack), noMatches func(), loadFailed func(e FriendlyException)) AudioLoadResultHandler
type AudioPlaylist ¶
type AudioPlaylist interface { Name() string Tracks() []AudioTrack SelectedTrack() AudioTrack }
func NewAudioPlaylist ¶
func NewAudioPlaylist(name string, selectedTrackIndex int, tracks []AudioTrack) AudioPlaylist
type AudioTrack ¶
type AudioTrack interface { Info() AudioTrackInfo SetPosition(position Duration) UserData() any SetUserData(any) Clone() AudioTrack }
func DecodeString ¶
func DecodeString(str string, customTrackInfoDecoder CustomTrackInfoDecoder) (track AudioTrack, err error)
func NewAudioTrack ¶
func NewAudioTrack(info AudioTrackInfo) AudioTrack
type AudioTrackEndReason ¶
type AudioTrackEndReason string
const ( AudioTrackEndReasonFinished AudioTrackEndReason = "FINISHED" AudioTrackEndReasonLoadFailed AudioTrackEndReason = "LOAD_FAILED" AudioTrackEndReasonStopped AudioTrackEndReason = "STOPPED" AudioTrackEndReasonReplaced AudioTrackEndReason = "REPLACED" AudioTrackEndReasonCleanup AudioTrackEndReason = "CLEANUP" )
func (AudioTrackEndReason) MayStartNext ¶
func (e AudioTrackEndReason) MayStartNext() bool
type AudioTrackInfo ¶
type BasicAudioPlaylist ¶
type BasicAudioPlaylist struct { PlaylistName string SelectedTrackIndex int PlaylistTracks []AudioTrack }
func (BasicAudioPlaylist) Name ¶
func (p BasicAudioPlaylist) Name() string
func (BasicAudioPlaylist) SelectedTrack ¶
func (p BasicAudioPlaylist) SelectedTrack() AudioTrack
func (BasicAudioPlaylist) Tracks ¶
func (p BasicAudioPlaylist) Tracks() []AudioTrack
type BasicAudioTrack ¶
type BasicAudioTrack struct { AudioTrackInfo AudioTrackInfo `json:"info"` // contains filtered or unexported fields }
func (*BasicAudioTrack) Clone ¶
func (t *BasicAudioTrack) Clone() AudioTrack
func (*BasicAudioTrack) Info ¶
func (t *BasicAudioTrack) Info() AudioTrackInfo
func (*BasicAudioTrack) SetPosition ¶
func (t *BasicAudioTrack) SetPosition(position Duration)
func (*BasicAudioTrack) SetUserData ¶
func (t *BasicAudioTrack) SetUserData(userData any)
func (*BasicAudioTrack) UserData ¶
func (t *BasicAudioTrack) UserData() any
type Config ¶
func DefaultConfig ¶ added in v1.7.0
func DefaultConfig() *Config
type ConfigOpt ¶
type ConfigOpt func(config *Config)
func WithHTTPClient ¶
func WithLogger ¶
WithLogger lets you inject your own logger implementing log.Logger
func WithOverwritePlugins ¶ added in v1.7.0
func WithPlugins ¶
func WithUserID ¶
func WithUserID(userID snowflake.ID) ConfigOpt
func WithUserIDFromBotToken ¶
func WithUserIDString ¶
type ConfigureResumingCommand ¶
func (ConfigureResumingCommand) MarshalJSON ¶
func (c ConfigureResumingCommand) MarshalJSON() ([]byte, error)
func (ConfigureResumingCommand) Op ¶
func (ConfigureResumingCommand) Op() OpType
func (ConfigureResumingCommand) OpCommand ¶
func (ConfigureResumingCommand) OpCommand()
type CustomTrackEncoder ¶
type CustomTrackEncoder func(track AudioTrack, w io.Writer) error
type CustomTrackInfoDecoder ¶
type CustomTrackInfoDecoder func(info AudioTrackInfo, r io.Reader) (AudioTrack, error)
type DefaultFilters ¶
type DefaultFilters struct { FilterVolume *Volume `json:"volume,omitempty"` FilterEqualizer *Equalizer `json:"equalizer,omitempty"` FilterTimescale *Timescale `json:"timescale,omitempty"` FilterTremolo *Tremolo `json:"tremolo,omitempty"` FilterVibrato *Vibrato `json:"vibrato,omitempty"` FilterRotation *Rotation `json:"rotation,omitempty"` FilterKaraoke *Karaoke `json:"karaoke,omitempty"` FilterDistortion *Distortion `json:"distortion,omitempty"` // contains filtered or unexported fields }
func (*DefaultFilters) Clear ¶
func (f *DefaultFilters) Clear() Filters
func (*DefaultFilters) Commit ¶
func (f *DefaultFilters) Commit() error
func (*DefaultFilters) Distortion ¶
func (f *DefaultFilters) Distortion() *Distortion
func (*DefaultFilters) Equalizer ¶
func (f *DefaultFilters) Equalizer() *Equalizer
func (*DefaultFilters) Karaoke ¶
func (f *DefaultFilters) Karaoke() *Karaoke
func (*DefaultFilters) Rotation ¶
func (f *DefaultFilters) Rotation() *Rotation
func (*DefaultFilters) SetDistortion ¶
func (f *DefaultFilters) SetDistortion(distortion *Distortion) Filters
func (*DefaultFilters) SetEqualizer ¶
func (f *DefaultFilters) SetEqualizer(equalizer *Equalizer) Filters
func (*DefaultFilters) SetKaraoke ¶
func (f *DefaultFilters) SetKaraoke(karaoke *Karaoke) Filters
func (*DefaultFilters) SetRotation ¶
func (f *DefaultFilters) SetRotation(rotation *Rotation) Filters
func (*DefaultFilters) SetTimescale ¶
func (f *DefaultFilters) SetTimescale(timescale *Timescale) Filters
func (*DefaultFilters) SetTremolo ¶
func (f *DefaultFilters) SetTremolo(tremolo *Tremolo) Filters
func (*DefaultFilters) SetVibrato ¶
func (f *DefaultFilters) SetVibrato(vibrato *Vibrato) Filters
func (*DefaultFilters) SetVolume ¶
func (f *DefaultFilters) SetVolume(volume *Volume) Filters
func (*DefaultFilters) Timescale ¶
func (f *DefaultFilters) Timescale() *Timescale
func (*DefaultFilters) Tremolo ¶
func (f *DefaultFilters) Tremolo() *Tremolo
func (*DefaultFilters) Vibrato ¶
func (f *DefaultFilters) Vibrato() *Vibrato
func (*DefaultFilters) Volume ¶
func (f *DefaultFilters) Volume() *Volume
type DefaultPlayer ¶
type DefaultPlayer struct {
// contains filtered or unexported fields
}
func (*DefaultPlayer) AddListener ¶
func (p *DefaultPlayer) AddListener(listener any)
func (*DefaultPlayer) ChangeNode ¶
func (p *DefaultPlayer) ChangeNode(node Node)
func (*DefaultPlayer) ChannelID ¶
func (p *DefaultPlayer) ChannelID() *snowflake.ID
func (*DefaultPlayer) Connected ¶
func (p *DefaultPlayer) Connected() bool
func (*DefaultPlayer) Destroy ¶
func (p *DefaultPlayer) Destroy() error
func (*DefaultPlayer) EmitEvent ¶
func (p *DefaultPlayer) EmitEvent(caller func(l any))
func (*DefaultPlayer) Export ¶
func (p *DefaultPlayer) Export() PlayerRestoreState
func (*DefaultPlayer) Filters ¶
func (p *DefaultPlayer) Filters() Filters
func (*DefaultPlayer) GuildID ¶
func (p *DefaultPlayer) GuildID() snowflake.ID
func (*DefaultPlayer) Node ¶
func (p *DefaultPlayer) Node() Node
func (*DefaultPlayer) OnEvent ¶ added in v1.7.2
func (p *DefaultPlayer) OnEvent(event TrackEvent)
func (*DefaultPlayer) OnPlayerUpdate ¶
func (p *DefaultPlayer) OnPlayerUpdate(state PlayerState)
func (*DefaultPlayer) OnVoiceServerUpdate ¶
func (p *DefaultPlayer) OnVoiceServerUpdate(voiceServerUpdate VoiceServerUpdate)
func (*DefaultPlayer) OnVoiceStateUpdate ¶
func (p *DefaultPlayer) OnVoiceStateUpdate(voiceStateUpdate VoiceStateUpdate)
func (*DefaultPlayer) Pause ¶
func (p *DefaultPlayer) Pause(pause bool) error
func (*DefaultPlayer) Paused ¶
func (p *DefaultPlayer) Paused() bool
func (*DefaultPlayer) Play ¶
func (p *DefaultPlayer) Play(track AudioTrack) error
func (*DefaultPlayer) PlayAt ¶
func (p *DefaultPlayer) PlayAt(track AudioTrack, start Duration, end Duration) error
func (*DefaultPlayer) PlayTrack ¶ added in v1.5.2
func (p *DefaultPlayer) PlayTrack(track AudioTrack, options PlayOptions) error
func (*DefaultPlayer) PlayingTrack ¶
func (p *DefaultPlayer) PlayingTrack() AudioTrack
func (*DefaultPlayer) Position ¶
func (p *DefaultPlayer) Position() Duration
func (*DefaultPlayer) RemoveListener ¶
func (p *DefaultPlayer) RemoveListener(listener any)
func (*DefaultPlayer) Seek ¶
func (p *DefaultPlayer) Seek(position Duration) error
func (*DefaultPlayer) SetFilters ¶
func (p *DefaultPlayer) SetFilters(filters Filters)
func (*DefaultPlayer) SetVolume ¶
func (p *DefaultPlayer) SetVolume(volume int) error
func (*DefaultPlayer) Stop ¶
func (p *DefaultPlayer) Stop() error
func (*DefaultPlayer) Volume ¶
func (p *DefaultPlayer) Volume() int
type DestroyCommand ¶
type DestroyCommand struct {
GuildID snowflake.ID `json:"guildId"`
}
func (DestroyCommand) MarshalJSON ¶
func (c DestroyCommand) MarshalJSON() ([]byte, error)
func (DestroyCommand) Op ¶
func (DestroyCommand) Op() OpType
func (DestroyCommand) OpCommand ¶
func (DestroyCommand) OpCommand()
type Distortion ¶
type Duration ¶
type Duration int64
func (Duration) Milliseconds ¶
func (Duration) MillisecondsPart ¶
func (Duration) MinutesPart ¶
func (Duration) SecondsPart ¶
type Equalizer ¶
type Equalizer [15]float32
func (Equalizer) MarshalJSON ¶
MarshalJSON marshals the map as object array
type EventPlugin ¶ added in v1.7.0
type EventPlugins ¶ added in v1.7.0
type EventPlugins interface {
EventPlugins() []EventPlugin
}
type Filters ¶
type Filters interface { Volume() *Volume Equalizer() *Equalizer Timescale() *Timescale Tremolo() *Tremolo Vibrato() *Vibrato Rotation() *Rotation Karaoke() *Karaoke Distortion() *Distortion SetVolume(v *Volume) Filters SetEqualizer(equalizer *Equalizer) Filters SetTimescale(timescale *Timescale) Filters SetTremolo(tremolo *Tremolo) Filters SetVibrato(vibrato *Vibrato) Filters SetRotation(rotation *Rotation) Filters SetKaraoke(karaoke *Karaoke) Filters SetDistortion(distortion *Distortion) Filters Clear() Filters Commit() error // contains filtered or unexported methods }
func NewFilters ¶
type FiltersCommand ¶
type FiltersCommand struct { GuildID snowflake.ID `json:"guildId"` Filters }
func (FiltersCommand) MarshalJSON ¶
func (c FiltersCommand) MarshalJSON() ([]byte, error)
func (FiltersCommand) Op ¶
func (FiltersCommand) Op() OpType
func (FiltersCommand) OpCommand ¶
func (FiltersCommand) OpCommand()
type FrameStats ¶
type FriendlyException ¶
type FriendlyException struct { Message string `json:"message"` Severity Severity `json:"severity"` Cause *string `json:"cause,omitempty"` }
func (FriendlyException) Error ¶
func (e FriendlyException) Error() string
type FunctionalResultHandler ¶
type FunctionalResultHandler struct {
// contains filtered or unexported fields
}
func (FunctionalResultHandler) LoadFailed ¶
func (h FunctionalResultHandler) LoadFailed(e FriendlyException)
func (FunctionalResultHandler) NoMatches ¶
func (h FunctionalResultHandler) NoMatches()
func (FunctionalResultHandler) PlaylistLoaded ¶
func (h FunctionalResultHandler) PlaylistLoaded(playlist AudioPlaylist)
func (FunctionalResultHandler) SearchResultLoaded ¶
func (h FunctionalResultHandler) SearchResultLoaded(tracks []AudioTrack)
func (FunctionalResultHandler) TrackLoaded ¶
func (h FunctionalResultHandler) TrackLoaded(track AudioTrack)
type HTTPAudioTrack ¶ added in v1.7.0
type HTTPAudioTrack struct { AudioTrack ProbeInfo string `json:"probeInfo"` }
func (*HTTPAudioTrack) Clone ¶ added in v1.7.0
func (t *HTTPAudioTrack) Clone() AudioTrack
func (*HTTPAudioTrack) UnmarshalJSON ¶ added in v1.7.0
func (t *HTTPAudioTrack) UnmarshalJSON(data []byte) error
type HTTPSourcePlugin ¶ added in v1.7.0
type HTTPSourcePlugin struct{}
func NewHTTPSourcePlugin ¶ added in v1.7.0
func NewHTTPSourcePlugin() *HTTPSourcePlugin
func (*HTTPSourcePlugin) Decode ¶ added in v1.7.0
func (p *HTTPSourcePlugin) Decode(info AudioTrackInfo, r io.Reader) (AudioTrack, error)
func (*HTTPSourcePlugin) Encode ¶ added in v1.7.0
func (p *HTTPSourcePlugin) Encode(track AudioTrack, w io.Writer) error
func (*HTTPSourcePlugin) SourceName ¶ added in v1.7.0
func (*HTTPSourcePlugin) SourceName() string
type Lavalink ¶
type Lavalink interface { Logger() log.Logger AddNode(ctx context.Context, config NodeConfig) (Node, error) Nodes() []Node Node(name string) Node BestNode() Node BestRestClient() RestClient RemoveNode(name string) AddPlugins(plugins ...any) Plugins() []any RemovePlugins(plugins ...any) EncodeTrack(track AudioTrack) (string, error) DecodeTrack(track string) (AudioTrack, error) Player(guildID snowflake.ID) Player PlayerOnNode(name string, guildID snowflake.ID) Player RestorePlayer(restoreState PlayerRestoreState) (Player, error) ExistingPlayer(guildID snowflake.ID) Player RemovePlayer(guildID snowflake.ID) Players() map[snowflake.ID]Player UserID() snowflake.ID SetUserID(userID snowflake.ID) Close() OnVoiceServerUpdate(voiceServerUpdate VoiceServerUpdate) OnVoiceStateUpdate(voiceStateUpdate VoiceStateUpdate) }
type LoadResult ¶
type LoadResult struct { LoadType LoadType `json:"loadType"` PlaylistInfo *PlaylistInfo `json:"playlistInfo"` Tracks []RestAudioTrack `json:"tracks"` Exception *FriendlyException `json:"exception"` }
type LocalAudioTrack ¶ added in v1.7.0
type LocalAudioTrack struct { AudioTrack ProbeInfo string `json:"probeInfo"` }
func (*LocalAudioTrack) Clone ¶ added in v1.7.0
func (t *LocalAudioTrack) Clone() AudioTrack
func (*LocalAudioTrack) UnmarshalJSON ¶ added in v1.7.0
func (t *LocalAudioTrack) UnmarshalJSON(data []byte) error
type LocalSourcePlugin ¶ added in v1.7.0
type LocalSourcePlugin struct{}
func NewLocalSourcePlugin ¶ added in v1.7.0
func NewLocalSourcePlugin() *LocalSourcePlugin
func (*LocalSourcePlugin) Decode ¶ added in v1.7.0
func (p *LocalSourcePlugin) Decode(info AudioTrackInfo, r io.Reader) (AudioTrack, error)
func (*LocalSourcePlugin) Encode ¶ added in v1.7.0
func (p *LocalSourcePlugin) Encode(track AudioTrack, w io.Writer) error
func (*LocalSourcePlugin) SourceName ¶ added in v1.7.0
func (*LocalSourcePlugin) SourceName() string
type Node ¶
type Node interface { Lavalink() Lavalink Send(cmd OpCommand) error ConfigureResuming(key string, timeoutSeconds int) error Open(ctx context.Context) error Close() Name() string RestClient() RestClient RestURL() string Config() NodeConfig Stats() *Stats Status() NodeStatus }
type NodeConfig ¶
type NodeStatus ¶
type NodeStatus string
const ( Connecting NodeStatus = "CONNECTING" Connected NodeStatus = "CONNECTED" Reconnecting NodeStatus = "RECONNECTING" Disconnected NodeStatus = "DISCONNECTED" )
Indicates how far along the client is to connecting
type OpType ¶
type OpType string
const ( OpTypePlay OpType = "play" OpTypeStop OpType = "stop" OpTypePause OpType = "pause" OpTypeSeek OpType = "seek" OpTypeVolume OpType = "volume" OpTypeDestroy OpType = "destroy" OpTypeStats OpType = "stats" OpTypeVoiceUpdate OpType = "voiceUpdate" OpTypePlayerUpdate OpType = "playerUpdate" OpTypeEvent OpType = "event" OpTypeConfigureResuming OpType = "configureResuming" OpTypeFilters OpType = "filters" )
type PauseCommand ¶
type PauseCommand struct { GuildID snowflake.ID `json:"guildId"` Pause bool `json:"pause"` }
func (PauseCommand) MarshalJSON ¶
func (c PauseCommand) MarshalJSON() ([]byte, error)
func (PauseCommand) Op ¶
func (PauseCommand) Op() OpType
func (PauseCommand) OpCommand ¶
func (PauseCommand) OpCommand()
type PlayCommand ¶
type PlayCommand struct { GuildID snowflake.ID `json:"guildId"` Track string `json:"track"` StartTime *Duration `json:"startTime,omitempty"` EndTime *Duration `json:"endTime,omitempty"` NoReplace *bool `json:"noReplace,omitempty"` Pause *bool `json:"pause,omitempty"` Volume *int `json:"volume,omitempty"` }
func (PlayCommand) MarshalJSON ¶
func (c PlayCommand) MarshalJSON() ([]byte, error)
func (PlayCommand) Op ¶
func (PlayCommand) Op() OpType
func (PlayCommand) OpCommand ¶
func (PlayCommand) OpCommand()
type PlayOptions ¶ added in v1.5.2
type Player ¶
type Player interface { PlayingTrack() AudioTrack Paused() bool Position() Duration Connected() bool Volume() int Filters() Filters GuildID() snowflake.ID ChannelID() *snowflake.ID Node() Node Export() PlayerRestoreState Play(track AudioTrack) error PlayTrack(track AudioTrack, options PlayOptions) error PlayAt(track AudioTrack, start Duration, end Duration) error Stop() error Destroy() error Pause(paused bool) error Seek(position Duration) error SetVolume(volume int) error SetFilters(filters Filters) ChangeNode(node Node) OnVoiceServerUpdate(voiceServerUpdate VoiceServerUpdate) OnVoiceStateUpdate(voiceStateUpdate VoiceStateUpdate) OnPlayerUpdate(state PlayerState) EmitEvent(caller func(l any)) AddListener(listener any) RemoveListener(listener any) OnEvent(event TrackEvent) }
type PlayerEventAdapter ¶
type PlayerEventAdapter struct{}
func (PlayerEventAdapter) OnPlayerPause ¶
func (a PlayerEventAdapter) OnPlayerPause(player Player)
func (PlayerEventAdapter) OnPlayerResume ¶
func (a PlayerEventAdapter) OnPlayerResume(player Player)
func (PlayerEventAdapter) OnPlayerUpdate ¶
func (a PlayerEventAdapter) OnPlayerUpdate(player Player, state PlayerState)
func (PlayerEventAdapter) OnTrackEnd ¶
func (a PlayerEventAdapter) OnTrackEnd(player Player, track AudioTrack, endReason AudioTrackEndReason)
func (PlayerEventAdapter) OnTrackException ¶
func (a PlayerEventAdapter) OnTrackException(player Player, track AudioTrack, exception FriendlyException)
func (PlayerEventAdapter) OnTrackStart ¶
func (a PlayerEventAdapter) OnTrackStart(player Player, track AudioTrack)
func (PlayerEventAdapter) OnTrackStuck ¶
func (a PlayerEventAdapter) OnTrackStuck(player Player, track AudioTrack, thresholdMs Duration)
func (PlayerEventAdapter) OnWebSocketClosed ¶
func (a PlayerEventAdapter) OnWebSocketClosed(player Player, code int, reason string, byRemote bool)
type PlayerEventListener ¶
type PlayerEventListener interface { OnPlayerPause(player Player) OnPlayerResume(player Player) OnPlayerUpdate(player Player, state PlayerState) OnTrackStart(player Player, track AudioTrack) OnTrackEnd(player Player, track AudioTrack, endReason AudioTrackEndReason) OnTrackException(player Player, track AudioTrack, exception FriendlyException) OnTrackStuck(player Player, track AudioTrack, thresholdMs Duration) OnWebSocketClosed(player Player, code int, reason string, byRemote bool) }
type PlayerRestoreState ¶
type PlayerRestoreState struct { PlayingTrack *string `json:"playing_track"` Paused bool `json:"paused"` State PlayerState `json:"state"` Volume int `json:"volume"` Filters Filters `json:"filters"` GuildID snowflake.ID `json:"guild_id"` ChannelID *snowflake.ID `json:"channel_id"` LastSessionID *string `json:"last_session_id"` LastVoiceServerUpdate *VoiceServerUpdate `json:"last_voice_server_update"` Node string `json:"node"` }
func (*PlayerRestoreState) UnmarshalJSON ¶
func (s *PlayerRestoreState) UnmarshalJSON(data []byte) error
type PlayerState ¶
type PlayerUpdateOp ¶
type PlayerUpdateOp struct { GuildID snowflake.ID `json:"guildId"` State PlayerState `json:"state"` }
func (PlayerUpdateOp) Op ¶
func (PlayerUpdateOp) Op() OpType
type PlaylistInfo ¶
type PluginEventAdapter ¶
type PluginEventAdapter struct{}
func (PluginEventAdapter) OnDestroyPlayer ¶
func (a PluginEventAdapter) OnDestroyPlayer(player Player)
func (PluginEventAdapter) OnNewPlayer ¶
func (a PluginEventAdapter) OnNewPlayer(player Player)
func (PluginEventAdapter) OnNodeDestroy ¶
func (a PluginEventAdapter) OnNodeDestroy(node Node)
func (PluginEventAdapter) OnNodeMessageIn ¶
func (a PluginEventAdapter) OnNodeMessageIn(node Node, data []byte)
func (PluginEventAdapter) OnNodeMessageOut ¶
func (a PluginEventAdapter) OnNodeMessageOut(node Node, data []byte)
func (PluginEventAdapter) OnNodeOpen ¶
func (a PluginEventAdapter) OnNodeOpen(node Node)
type PluginEventHandler ¶
type RestAudioTrack ¶
type RestAudioTrack struct { Track string `json:"track"` Info AudioTrackInfo `json:"info"` }
type RestClient ¶
type RestClient interface { Version(ctx context.Context) (string, error) Plugins(ctx context.Context) ([]Plugin, error) LoadItem(ctx context.Context, identifier string) (*LoadResult, error) LoadItemHandler(ctx context.Context, identifier string, audioLoaderResultHandler AudioLoadResultHandler) error DecodeTrack(ctx context.Context, track string) (*AudioTrackInfo, error) DecodeTracks(ctx context.Context, tracks []string) ([]RestAudioTrack, error) }
type SearchType ¶
type SearchType string
const ( SearchTypeYoutube SearchType = "ytsearch" SearchTypeYoutubeMusic SearchType = "ytmsearch" SearchTypeSoundCloud SearchType = "scsearch" )
search prefixes
func (SearchType) Apply ¶
func (t SearchType) Apply(searchString string) string
type SeekCommand ¶
type SeekCommand struct { GuildID snowflake.ID `json:"guildId"` Position Duration `json:"position"` }
func (SeekCommand) MarshalJSON ¶
func (c SeekCommand) MarshalJSON() ([]byte, error)
func (SeekCommand) Op ¶
func (SeekCommand) Op() OpType
func (SeekCommand) OpCommand ¶
func (SeekCommand) OpCommand()
type SourcePlugin ¶ added in v1.7.0
type SourcePlugin interface { SourceName() string Encode(track AudioTrack, w io.Writer) error Decode(info AudioTrackInfo, r io.Reader) (AudioTrack, error) }
type Stats ¶
type StopCommand ¶
type StopCommand struct {
GuildID snowflake.ID `json:"guildId"`
}
func (StopCommand) MarshalJSON ¶
func (c StopCommand) MarshalJSON() ([]byte, error)
func (StopCommand) Op ¶
func (StopCommand) Op() OpType
func (StopCommand) OpCommand ¶
func (StopCommand) OpCommand()
type TrackEndEvent ¶
type TrackEndEvent struct { GID snowflake.ID `json:"guildId"` TrackString string `json:"track"` Reason AudioTrackEndReason `json:"reason"` }
func (TrackEndEvent) Event ¶
func (TrackEndEvent) Event() EventType
func (TrackEndEvent) GuildID ¶
func (e TrackEndEvent) GuildID() snowflake.ID
func (TrackEndEvent) Op ¶
func (TrackEndEvent) Op() OpType
func (TrackEndEvent) OpEvent ¶
func (TrackEndEvent) OpEvent()
func (TrackEndEvent) Track ¶
func (e TrackEndEvent) Track() string
type TrackEvent ¶
type TrackEvent interface {
Track() string
}
type TrackExceptionEvent ¶
type TrackExceptionEvent struct { GID snowflake.ID `json:"guildId"` TrackString string `json:"track"` Exception FriendlyException `json:"exception"` }
func (TrackExceptionEvent) Event ¶
func (TrackExceptionEvent) Event() EventType
func (TrackExceptionEvent) GuildID ¶
func (e TrackExceptionEvent) GuildID() snowflake.ID
func (TrackExceptionEvent) Op ¶
func (TrackExceptionEvent) Op() OpType
func (TrackExceptionEvent) OpEvent ¶
func (TrackExceptionEvent) OpEvent()
func (TrackExceptionEvent) Track ¶
func (e TrackExceptionEvent) Track() string
type TrackStartEvent ¶
type TrackStartEvent struct { GID snowflake.ID `json:"guildId"` TrackString string `json:"track"` }
func (TrackStartEvent) Event ¶
func (TrackStartEvent) Event() EventType
func (TrackStartEvent) GuildID ¶
func (e TrackStartEvent) GuildID() snowflake.ID
func (TrackStartEvent) Op ¶
func (TrackStartEvent) Op() OpType
func (TrackStartEvent) OpEvent ¶
func (TrackStartEvent) OpEvent()
func (TrackStartEvent) Track ¶
func (e TrackStartEvent) Track() string
type TrackStuckEvent ¶
type TrackStuckEvent struct { GID snowflake.ID `json:"guildId"` TrackString string `json:"track"` ThresholdMs Duration `json:"threasholdMs"` }
func (TrackStuckEvent) Event ¶
func (TrackStuckEvent) Event() EventType
func (TrackStuckEvent) GuildID ¶
func (e TrackStuckEvent) GuildID() snowflake.ID
func (TrackStuckEvent) Op ¶
func (TrackStuckEvent) Op() OpType
func (TrackStuckEvent) OpEvent ¶
func (TrackStuckEvent) OpEvent()
func (TrackStuckEvent) Track ¶
func (e TrackStuckEvent) Track() string
type UnknownEvent ¶
type UnknownEvent struct { Data []byte // contains filtered or unexported fields }
func (UnknownEvent) Event ¶
func (e UnknownEvent) Event() EventType
func (UnknownEvent) GuildID ¶
func (e UnknownEvent) GuildID() snowflake.ID
func (UnknownEvent) MarshalJSON ¶
func (e UnknownEvent) MarshalJSON() ([]byte, error)
func (UnknownEvent) Op ¶
func (UnknownEvent) Op() OpType
func (UnknownEvent) OpEvent ¶
func (UnknownEvent) OpEvent()
func (*UnknownEvent) UnmarshalJSON ¶
func (e *UnknownEvent) UnmarshalJSON(data []byte) error
type UnknownOp ¶
type UnknownOp struct { Data []byte // contains filtered or unexported fields }
func (UnknownOp) MarshalJSON ¶
func (*UnknownOp) UnmarshalJSON ¶
type UnmarshalOp ¶
type UnmarshalOp struct {
Op
}
func (*UnmarshalOp) UnmarshalJSON ¶
func (e *UnmarshalOp) UnmarshalJSON(data []byte) error
type UnmarshalOpEvent ¶
type UnmarshalOpEvent struct {
OpEvent
}
func (*UnmarshalOpEvent) UnmarshalJSON ¶
func (e *UnmarshalOpEvent) UnmarshalJSON(data []byte) error
type VoiceServerUpdate ¶
type VoiceStateUpdate ¶
type VoiceStateUpdate struct { GuildID snowflake.ID `json:"guild_id"` ChannelID *snowflake.ID `json:"channel_id"` SessionID string `json:"session_id"` }
type VoiceUpdateCommand ¶
type VoiceUpdateCommand struct { GuildID snowflake.ID `json:"guildId"` SessionID string `json:"sessionId"` Event VoiceServerUpdate `json:"event"` }
func (VoiceUpdateCommand) MarshalJSON ¶
func (c VoiceUpdateCommand) MarshalJSON() ([]byte, error)
func (VoiceUpdateCommand) Op ¶
func (VoiceUpdateCommand) Op() OpType
func (VoiceUpdateCommand) OpCommand ¶
func (VoiceUpdateCommand) OpCommand()
type VolumeCommand ¶
type VolumeCommand struct { GuildID snowflake.ID `json:"guildId"` Volume int `json:"volume"` }
func (VolumeCommand) MarshalJSON ¶
func (c VolumeCommand) MarshalJSON() ([]byte, error)
func (VolumeCommand) Op ¶
func (VolumeCommand) Op() OpType
func (VolumeCommand) OpCommand ¶
func (VolumeCommand) OpCommand()
type WebsocketClosedEvent ¶
type WebsocketClosedEvent struct { GID snowflake.ID `json:"guildId"` Code int `json:"code"` Reason string `json:"reason"` ByRemote bool `json:"byRemote"` }
func (WebsocketClosedEvent) Event ¶
func (WebsocketClosedEvent) Event() EventType
func (WebsocketClosedEvent) GuildID ¶
func (e WebsocketClosedEvent) GuildID() snowflake.ID
func (WebsocketClosedEvent) Op ¶
func (WebsocketClosedEvent) Op() OpType
func (WebsocketClosedEvent) OpEvent ¶
func (WebsocketClosedEvent) OpEvent()
Source Files ¶
- audio_playlist.go
- audio_track.go
- audio_track_decode.go
- audio_track_encode.go
- audio_track_end_reason.go
- duration.go
- filters.go
- friendly_exception.go
- info.go
- lavalink.go
- lavalink_config.go
- load_result.go
- node.go
- op.go
- op_commands.go
- op_events.go
- player.go
- player_listener.go
- plugin.go
- restclient.go
- source_plugins.go
- stats.go
- time.go
- token.go
- voice_update.go
Click to show internal directories.
Click to hide internal directories.