Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LeaveResult ¶
type LeaveResult int
const ( LeaveResultKeepAlive LeaveResult = iota LeaveResultClose )
LeaveResult indicates which action to take after a user leaves the voice channel. LeaveResultKeepAlive means to keep the session alive, allowing it to continue processing messages. LeaveResultClose means to close the session, as there are no users left in the voice channel.
type NoOpSessionLifecycleObserver ¶ added in v0.4.0
type NoOpSessionLifecycleObserver struct{}
func (NoOpSessionLifecycleObserver) OnCreated ¶ added in v0.4.0
func (NoOpSessionLifecycleObserver) OnCreated(event SessionCreatedEvent)
func (NoOpSessionLifecycleObserver) OnDeleted ¶ added in v0.4.0
func (NoOpSessionLifecycleObserver) OnDeleted(event SessionDeletedEvent)
type PersistenceManager ¶ added in v0.4.0
type PersistenceManager struct { NoOpSessionLifecycleObserver // contains filtered or unexported fields }
func NewPersistenceManager ¶ added in v0.4.0
func NewPersistenceManager(applicationID snowflake.ID, redisClient *redis.Client, heatbeatInterval time.Duration) *PersistenceManager
func (*PersistenceManager) OnCreated ¶ added in v0.4.0
func (p *PersistenceManager) OnCreated(e SessionCreatedEvent)
func (*PersistenceManager) OnDeleted ¶ added in v0.4.0
func (p *PersistenceManager) OnDeleted(e SessionDeletedEvent)
func (*PersistenceManager) Restore ¶ added in v0.4.0
func (p *PersistenceManager) Restore(ctx context.Context, sessionManager SessionManager, sessionRestoreFunc SessionRestoreFunc) error
func (*PersistenceManager) StartHeartbeatLoop ¶ added in v0.4.0
func (p *PersistenceManager) StartHeartbeatLoop()
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func New ¶
func New(engineRegistry *tts.EngineRegistry, presetResolver preset.PresetResolver, textChannelID snowflake.ID, conn voice.Conn, tr *i18n.TextResource, vrs *i18n.VoiceResources) (*Session, error)
type SessionCreatedEvent ¶ added in v0.4.0
type SessionCreatedEvent struct {
// contains filtered or unexported fields
}
type SessionDeletedEvent ¶ added in v0.4.0
type SessionDeletedEvent struct {
// contains filtered or unexported fields
}
type SessionLifecycleObserver ¶ added in v0.4.0
type SessionLifecycleObserver interface { OnCreated(event SessionCreatedEvent) OnDeleted(event SessionDeletedEvent) }
type SessionManager ¶ added in v0.4.0
type SessionManager interface { // GetByVoiceChannel retrieves a session by its voice channel ID. GetByVoiceChannel(voiceChannelID snowflake.ID) (*Session, bool) // GetByReadingChannel retrieves a session by its reading channel ID. GetByReadingChannel(readingChannelID snowflake.ID) (*Session, bool) // Add adds a new session with the given voice and reading channel IDs. Add(guildID, voiceChannelID, readingChannelID snowflake.ID, session *Session) // Delete removes a session by its voice channel ID. Delete(guildID, voiceChannelID snowflake.ID) // AddObserver adds an observer to listen for session lifecycle events. AddObserver(observer SessionLifecycleObserver) // RemoveObserver removes an observer from listening for session lifecycle events. RemoveObserver(observer SessionLifecycleObserver) // CreateMessageHandler creates an event listener for message creation events. CreateMessageHandler() bot.EventListener // CreateVoiceStateHandler creates an event listener for voice state update events. CreateVoiceStateHandler() bot.EventListener }
func NewSessionManager ¶ added in v0.4.0
func NewSessionManager() SessionManager
type SessionRestoreFunc ¶ added in v0.4.0
type SpeechTask ¶ added in v0.1.1
type SpeechTask struct { Segments []string Preset preset.Preset // option: with speaker? ContainsSpeaker bool SpeakerName string SpeakerID snowflake.ID }
SpeechTask represents a task for text-to-speech processing.
func NewSpeechTask ¶ added in v0.4.0
func NewSpeechTask(segments []string, preset preset.Preset, opts ...SpeechTaskOpt) SpeechTask
type SpeechTaskOpt ¶ added in v0.4.0
type SpeechTaskOpt func(s *SpeechTask)
func WithSpeaker ¶ added in v0.4.0
func WithSpeaker(speakerName string, speakerID snowflake.ID) SpeechTaskOpt
Click to show internal directories.
Click to hide internal directories.