voice

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

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

Connection manages a Discord voice connection

func NewConnection

func NewConnection(voice *discordgo.VoiceConnection) *Connection

NewConnection creates a new voice connection manager from an existing VoiceConnection

func (*Connection) GetChannelID

func (c *Connection) GetChannelID() string

GetChannelID returns the channel ID

func (*Connection) GetGuildID

func (c *Connection) GetGuildID() string

GetGuildID returns the guild ID

func (*Connection) GetVoiceConnection

func (c *Connection) GetVoiceConnection() *discordgo.VoiceConnection

GetVoiceConnection returns the underlying discordgo voice connection

func (*Connection) IsConnected

func (c *Connection) IsConnected() bool

IsConnected returns whether the bot is connected to a voice channel

func (*Connection) Join

func (c *Connection) Join() error

Join connects to a voice channel

func (*Connection) Leave

func (c *Connection) Leave() error

Leave disconnects from the voice channel

type ConnectionManager

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

ConnectionManager manages multiple voice connections across guilds

func NewConnectionManager

func NewConnectionManager(session *discordgo.Session) *ConnectionManager

NewConnectionManager creates a new connection manager

func (*ConnectionManager) Close

func (m *ConnectionManager) Close()

Close disconnects from all voice channels

func (*ConnectionManager) GetConnection

func (m *ConnectionManager) GetConnection(guildID string) (*Connection, bool)

GetConnection returns the connection for a guild

func (*ConnectionManager) IsConnected

func (m *ConnectionManager) IsConnected(guildID string) bool

IsConnected checks if connected to a voice channel in a guild

func (*ConnectionManager) Join

func (m *ConnectionManager) Join(guildID, channelID string) (*Connection, error)

Join connects to a voice channel in a guild

func (*ConnectionManager) Leave

func (m *ConnectionManager) Leave(guildID string) error

Leave disconnects from a voice channel in a guild

type Player

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

Player handles audio playback to Discord voice channels using ffmpeg

func NewPlayer

func NewPlayer(conn *Connection) *Player

NewPlayer creates a new audio player

func (*Player) IsPlaying

func (p *Player) IsPlaying() bool

IsPlaying returns whether the player is currently playing

func (*Player) PlayFile

func (p *Player) PlayFile(filePath string) error

PlayFile plays an audio file using ffmpeg It automatically joins the channel, plays the file, and leaves when done or on interrupt

func (*Player) Stop

func (p *Player) Stop() error

Stop stops the playback

type Recorder

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

Recorder handles audio recording from Discord voice channels

func NewRecorder

func NewRecorder(conn *Connection) (*Recorder, error)

NewRecorder creates a new audio recorder

func (*Recorder) IsRecording

func (r *Recorder) IsRecording() bool

IsRecording returns whether the recorder is currently recording

func (*Recorder) RecordToFile

func (r *Recorder) RecordToFile(outputPath string) error

RecordToFile starts recording audio to an OGG file

func (*Recorder) Stop

func (r *Recorder) Stop() error

Stop stops the recording

Jump to

Keyboard shortcuts

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