soundboard

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2019 License: MIT Imports: 30 Imported by: 0

README

Soundboard

Soundboard plugin for YAGPDB

Folder structure:

Sounds waiting:

soundboard/queue/guildid/soundhash.extension

Transcoded sounds

soundboard/ready/guildid/soundhash.dca

Documentation

Index

Constants

View Source
const (
	MaxGuildSounds        = 50
	MaxGuildSoundsPremium = 250
)
View Source
const DBSchema = `` /* 1714-byte string literal not displayed */

Variables

View Source
var (
	ErrVoiceSendTimeout = errors.New("Voice send timeout")
)
View Source
var (
	Silence = []byte{0xF8, 0xFF, 0xFE}
)

Functions

func CanPlaySound added in v1.13.0

func CanPlaySound(s *models.SoundboardSound, roles []int64) bool

func DownloadNewSoundFile added in v1.4.1

func DownloadNewSoundFile(r io.Reader, w io.Writer, limit int) (tooBig bool, err error)

func GetSoundboardSounds added in v1.13.0

func GetSoundboardSounds(guildID int64, ctx context.Context) ([]*models.SoundboardSound, error)

func HandleDelete

func HandleDelete(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)

func HandleGetCP

func HandleGetCP(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)

func HandleNew

func HandleNew(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)

func HandleUpdate

func HandleUpdate(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)

func KeySoundLock

func KeySoundLock(id int) string

func ListSounds

func ListSounds(sounds []*models.SoundboardSound, ms *dstate.MemberState) string

func MaxSoundsForContext added in v1.6.0

func MaxSoundsForContext(ctx context.Context) int

func RegisterPlugin

func RegisterPlugin()

func RequestPlaySound

func RequestPlaySound(guildID int64, channelID, channelRanFrom int64, soundID int) (queued bool)

RequestPlaySound either queues up a sound to be played in an existing player or creates a new one

func SoundFilePath

func SoundFilePath(id int, status TranscodingStatus) string

Types

type PlayRequest

type PlayRequest struct {
	ChannelID      int64
	GuildID        int64
	CommandRanFrom int64
	Sound          int
}

type Plugin

type Plugin struct{}

func (*Plugin) AddCommands added in v1.4.1

func (p *Plugin) AddCommands()

func (*Plugin) InitWeb

func (p *Plugin) InitWeb()

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) RunBackgroundWorker added in v1.11.0

func (p *Plugin) RunBackgroundWorker()

func (*Plugin) StopBackgroundWorker added in v1.11.0

func (p *Plugin) StopBackgroundWorker(wg *sync.WaitGroup)

type PostForm added in v1.13.0

type PostForm struct {
	ID   int
	Name string `valid:",100"`

	RequiredRoles    []int64 `valid:"role"`
	BlacklistedRoles []int64 `valid:"role"`
}

func (*PostForm) ToDBModel added in v1.13.0

func (pf *PostForm) ToDBModel() *models.SoundboardSound

type TranscodingStatus

type TranscodingStatus int
const (
	// In the transcoding queue
	TranscodingStatusQueued TranscodingStatus = iota
	// Done transcoding and ready to be played
	TranscodingStatusReady
	// Currently transcoding
	TranscodingStatusTranscoding
	// Failed transcoding, too long
	TranscodingStatusFailedLong
	// Failed transcofing, contact support
	TranscodingStatusFailedOther
)

func (TranscodingStatus) String

func (s TranscodingStatus) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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