voice

package
v0.0.0-...-4f3d646 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheDirAudioKey = "CACHE_AUDIO_DIR"
)

Variables

This section is empty.

Functions

func AudioIDs

func AudioIDs() ([]string, error)

func Duration

func Duration(path string) (duration time.Duration, err error)

func Path

func Path(id string) string

FIXME added name of files or searching file in local storage by ID

func Play

func Play(ctx context.Context, vc *discordgo.VoiceConnection, path string, stop <-chan struct{}) (err error)

func RandomAudioID

func RandomAudioID() (string, error)

Types

type AudioQueryType

type AudioQueryType byte
const (
	NameType AudioQueryType = 0x0
	IDType   AudioQueryType = 0x1
)

type AudioSearchService

type AudioSearchService interface {
	AudioFileInfo(ctx context.Context, params SearchParams, page uint) ([]api.AudioFileInfo, error)
	internal.ActiveChecker
}

type BotLocalStorage

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

TODO Added autocleaning cache after a few days

func NewBotLocalStorage

func NewBotLocalStorage() BotLocalStorage

func (BotLocalStorage) Active

func (b BotLocalStorage) Active(_ context.Context) bool

func (BotLocalStorage) Add

func (b BotLocalStorage) Add(ctx context.Context, file io.Reader, id, name string) (string, error)

func (BotLocalStorage) AudioFileInfo

func (b BotLocalStorage) AudioFileInfo(ctx context.Context, params SearchParams, page uint) ([]api.AudioFileInfo, error)

func (BotLocalStorage) Get

func (b BotLocalStorage) Get(ctx context.Context, params SearchParams) (path string, err error)

func (BotLocalStorage) Remove

func (b BotLocalStorage) Remove(ctx context.Context, params SearchParams) error

type ChatHandler

type ChatHandler struct {
	Ctx             context.Context
	SpockVoiceChns  SpockVoiceChannels
	GuildVoiceChats map[string]ChatInfo
}

func (*ChatHandler) HandleVoiceChannelUpdate

func (v *ChatHandler) HandleVoiceChannelUpdate(_ *discordgo.Session, vc *discordgo.VoiceStateUpdate)

type ChatInfo

type ChatInfo struct {
	UserCount uint
	ChannelID string
}

type SearchParams

type SearchParams struct {
	Type  AudioQueryType
	Value string
}

type SpockVoiceChannels

type SpockVoiceChannels map[string]chan struct{}

func (SpockVoiceChannels) Close

func (s SpockVoiceChannels) Close() error

Jump to

Keyboard shortcuts

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