Documentation ¶
Index ¶
- Variables
- func DownloadNewSoundFile(r io.Reader, w io.Writer, limit int) (tooBig bool, err error)
- func HandleDelete(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
- func HandleGetCP(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
- func HandleNew(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
- func HandleUpdate(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
- func KeySoundLock(id uint) string
- func ListSounds(config *SoundboardConfig, ms *dstate.MemberState) string
- func RegisterPlugin()
- func RequestPlaySound(guildID int64, channelID, channelRanFrom int64, soundID uint) (queued bool)
- func SoundFilePath(id uint, status TranscodingStatus) string
- type PlayRequest
- type Plugin
- func (p *Plugin) AddCommands()
- func (p *Plugin) BotInit()
- func (p *Plugin) GetGuildConfig(ctx context.Context, guildID int64, dest configstore.GuildConfig) (err error)
- func (p *Plugin) InitWeb()
- func (p *Plugin) Name() string
- func (p *Plugin) SetGuildConfig(ctx context.Context, conf configstore.GuildConfig) error
- func (p *Plugin) SetIfLatest(ctx context.Context, conf configstore.GuildConfig) (updated bool, err error)
- func (p *Plugin) StopBot(wg *sync.WaitGroup)
- type SoundboardConfig
- type SoundboardSound
- type TranscodingStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrVoiceSendTimeout = errors.New("Voice send timeout")
)
View Source
var (
Silence = []byte{0xF8, 0xFF, 0xFE}
)
Functions ¶
func DownloadNewSoundFile ¶ added in v1.4.1
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 ListSounds ¶
func ListSounds(config *SoundboardConfig, ms *dstate.MemberState) string
func RegisterPlugin ¶
func RegisterPlugin()
func RequestPlaySound ¶
RequestPlaySound either queues up a sound to be played in an existing player or creates a new one
func SoundFilePath ¶
func SoundFilePath(id uint, status TranscodingStatus) string
Types ¶
type PlayRequest ¶
type Plugin ¶
type Plugin struct{}
func (*Plugin) AddCommands ¶ added in v1.4.1
func (p *Plugin) AddCommands()
func (*Plugin) GetGuildConfig ¶
func (p *Plugin) GetGuildConfig(ctx context.Context, guildID int64, dest configstore.GuildConfig) (err error)
GetGuildConfig returns a GuildConfig item from db
func (*Plugin) SetGuildConfig ¶
func (p *Plugin) SetGuildConfig(ctx context.Context, conf configstore.GuildConfig) error
SetGuildConfig saves the GuildConfig struct
func (*Plugin) SetIfLatest ¶
func (p *Plugin) SetIfLatest(ctx context.Context, conf configstore.GuildConfig) (updated bool, err error)
SetIfLatest saves it only if the passedLatest time is the latest version
type SoundboardConfig ¶
type SoundboardConfig struct { configstore.GuildConfigModel Sounds []*SoundboardSound `gorm:"ForeignKey:GuildID;AssociationForeignKey:GuildID"` }
func (*SoundboardConfig) GetName ¶
func (sc *SoundboardConfig) GetName() string
type SoundboardSound ¶
type SoundboardSound struct { common.SmallModel GuildID int64 `gorm:"index"` RequiredRole string `valid:"role,true"` Name string `valid:",1,100"` Status TranscodingStatus }
func (*SoundboardSound) CanPlay ¶
func (s *SoundboardSound) CanPlay(roles []int64) bool
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
Click to show internal directories.
Click to hide internal directories.