Documentation ¶
Index ¶
- Variables
- func AacToPCM(in interface{}) (pcm []int16, sampleRate int)
- func YoutubeToAAC(url string) (aac []byte, info *goutubedl.Info, err error)
- func YoutubeToInfo(url string) (info *goutubedl.Info, err error)
- type Cache
- type CacheTypeConst
- type Event
- type InternalQueue
- func (i *InternalQueue) AddSong(ctx context.Context, song *pb.SongInfo) error
- func (i *InternalQueue) GetNextSong(ctx context.Context) (*pb.SongInfo, error)
- func (i *InternalQueue) GetQueue(ctx context.Context) ([]*pb.SongInfo, error)
- func (i *InternalQueue) GetQueueType() QueueTypeConst
- func (i *InternalQueue) Ready() bool
- func (i *InternalQueue) RemoveSong(ctx context.Context, song *pb.SongInfo) error
- func (i *InternalQueue) RemoveSongByIndex(ctx context.Context, remove int) (*pb.SongInfo, error)
- type Np
- type Op2
- type Op4
- type Op8
- type Queue
- type QueueType
- type QueueTypeConst
- type RedisQueue
- func (r *RedisQueue) AddSong(ctx context.Context, song *pb.SongInfo) error
- func (r *RedisQueue) GetNextSong(ctx context.Context) (*pb.SongInfo, error)
- func (r *RedisQueue) GetQueue(ctx context.Context) ([]*pb.SongInfo, error)
- func (r *RedisQueue) GetQueueType() QueueTypeConst
- func (r *RedisQueue) Ready() bool
- func (r *RedisQueue) RemoveSong(ctx context.Context, song *pb.SongInfo) error
- func (r *RedisQueue) RemoveSongByIndex(ctx context.Context, index int) (*pb.SongInfo, error)
- type VoiceConnection
- func (v *VoiceConnection) Close()
- func (v *VoiceConnection) GetDuration() int64
- func (v *VoiceConnection) GetElapsed() int64
- func (v *VoiceConnection) GetPCMLength() int
- func (v *VoiceConnection) MakeCache(c CacheTypeConst, options interface{}) error
- func (v *VoiceConnection) MakeQueue(qtype QueueTypeConst, options interface{}) error
- func (v *VoiceConnection) MusicPlayer(rate int, size int)
- func (v *VoiceConnection) Open() (err error)
- func (v *VoiceConnection) SetPCM(pcm []int16)
- func (v *VoiceConnection) SetQueueType(q QueueType)
- func (v *VoiceConnection) SetSpeaking(speaking bool) (err error)
- func (v *VoiceConnection) Skip() error
- func (v *VoiceConnection) Stop() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoSongFound = fmt.Errorf("no song found") IndexNotInRange = fmt.Errorf("index not in range") )
View Source
var ErrEmptyEndpoint = errors.New("empty endpoint")
View Source
var ErrNilClose = errors.New("nil close channel")
View Source
var (
ErrNoNextSong = fmt.Errorf("no next song")
)
View Source
var ErrOkIsFalse = errors.New("ok is false")
View Source
var ErrUDPOpen = errors.New("udp connection already open")
View Source
var ErrUDPSmallPacket = errors.New("recv udp packet is small")
View Source
var ErrVoiceWSNil = errors.New("nil voice websocket")
View Source
var ErrWSNotNil = errors.New("websocket not nil")
View Source
var YTDLPath = os.Getenv("YTDL_PATH")
Functions ¶
Types ¶
type Cache ¶
type Cache interface { AddSong(url string, aac []byte) GetSong(url string) (aac []byte, ok bool) AddInfo(url string, info *goutubedl.Info) GetInfo(url string) (info *goutubedl.Info, ok bool) // The following are internal no matter what PreloadSong(url string) error GetNextSong() (aac []byte, info *goutubedl.Info, err error) }
type CacheTypeConst ¶
type CacheTypeConst int
const ( CacheTypeInternal CacheTypeConst = iota CacheTypeRedis )
type Event ¶
type Event struct { Operation int `json:"op"` Sequence int64 `json:"s"` Type string `json:"t"` RawData json.RawMessage `json:"d"` }
type InternalQueue ¶
func (*InternalQueue) GetNextSong ¶
func (*InternalQueue) GetQueueType ¶
func (i *InternalQueue) GetQueueType() QueueTypeConst
func (*InternalQueue) Ready ¶
func (i *InternalQueue) Ready() bool
func (*InternalQueue) RemoveSong ¶
func (*InternalQueue) RemoveSongByIndex ¶
type QueueType ¶
type QueueType interface { AddSong(ctx context.Context, song *pb.SongInfo) error RemoveSong(ctx context.Context, song *pb.SongInfo) error RemoveSongByIndex(ctx context.Context, index int) (*pb.SongInfo, error) GetQueue(ctx context.Context) ([]*pb.SongInfo, error) GetQueueType() QueueTypeConst GetNextSong(ctx context.Context) (*pb.SongInfo, error) Ready() bool }
type QueueTypeConst ¶
type QueueTypeConst int
const ( RedisQueueType QueueTypeConst = iota InternalQueueType )
func (QueueTypeConst) String ¶
func (q QueueTypeConst) String() string
type RedisQueue ¶
type RedisQueue struct {
// contains filtered or unexported fields
}
func (*RedisQueue) GetNextSong ¶
func (*RedisQueue) GetQueueType ¶
func (r *RedisQueue) GetQueueType() QueueTypeConst
func (*RedisQueue) Ready ¶
func (r *RedisQueue) Ready() bool
func (*RedisQueue) RemoveSong ¶
func (*RedisQueue) RemoveSongByIndex ¶
type VoiceConnection ¶
type VoiceConnection struct { Mutex sync.RWMutex Ready bool UserID string GuildID string ChannelID string Deaf bool Mute bool Speaking bool Connected bool Reconnecting bool SessionID string Token string Endpoint string NowPlaying *Np Queue *Queue Cache Cache ByteTrack int OpusSend chan []byte Playing bool Paused bool Volume float32 Loop bool // contains filtered or unexported fields }
func (*VoiceConnection) Close ¶
func (v *VoiceConnection) Close()
func (*VoiceConnection) GetDuration ¶
func (v *VoiceConnection) GetDuration() int64
func (*VoiceConnection) GetElapsed ¶
func (v *VoiceConnection) GetElapsed() int64
func (*VoiceConnection) GetPCMLength ¶
func (v *VoiceConnection) GetPCMLength() int
func (*VoiceConnection) MakeCache ¶
func (v *VoiceConnection) MakeCache(c CacheTypeConst, options interface{}) error
func (*VoiceConnection) MakeQueue ¶
func (v *VoiceConnection) MakeQueue(qtype QueueTypeConst, options interface{}) error
func (*VoiceConnection) MusicPlayer ¶
func (v *VoiceConnection) MusicPlayer(rate int, size int)
func (*VoiceConnection) Open ¶
func (v *VoiceConnection) Open() (err error)
func (*VoiceConnection) SetPCM ¶
func (v *VoiceConnection) SetPCM(pcm []int16)
func (*VoiceConnection) SetQueueType ¶
func (v *VoiceConnection) SetQueueType(q QueueType)
func (*VoiceConnection) SetSpeaking ¶
func (v *VoiceConnection) SetSpeaking(speaking bool) (err error)
func (*VoiceConnection) Skip ¶
func (v *VoiceConnection) Skip() error
func (*VoiceConnection) Stop ¶
func (v *VoiceConnection) Stop() error
Click to show internal directories.
Click to hide internal directories.