DiscordVoiceManager
open class DiscordVoiceManager : DiscordVoiceEngineDelegate, Lockable
A manager for voice engines.
-
The delegate for this manager.
Declaration
Swift
public weak var delegate: DiscordVoiceManagerDelegate?
-
The configuration for engines.
Declaration
Swift
public var engineConfiguration: DiscordVoiceEngineConfiguration
-
The token for the user.
Declaration
Swift
public var token: DiscordToken
-
The voice engines, indexed by guild id.
Declaration
Swift
public private(set) var voiceEngines = [GuildID: DiscordVoiceEngine]()
-
The voice states for this user, if they are in any voice channels.
Declaration
Swift
public internal(set) var voiceStates = [GuildID: DiscordVoiceState]()
-
Creates a new manager with the delegate set.
Declaration
Swift
public init(delegate: DiscordVoiceManagerDelegate, engineConfiguration: DiscordVoiceEngineConfiguration = DiscordVoiceEngineConfiguration())
-
Leaves the voice channel that is associated with the guild specified.
Declaration
Swift
open func leaveVoiceChannel(onGuild guildId: GuildID)
Parameters
onGuild
The snowflake of the guild that you want to leave.
-
Tries to open a voice connection to the specified guild. Only succeeds if we have both a voice state and the voice server info for this guild.
Declaration
Swift
open func startVoiceConnection(_ guildId: GuildID)
Parameters
guildId
The id of the guild to connect to.
-
Called when the voice engine disconnects.
Declaration
Swift
open func voiceEngineDidDisconnect(_ engine: DiscordVoiceEngine)
Parameters
engine
The engine that disconnected.
-
Handles opus voice data received from a VoiceEngine
Declaration
Swift
open func voiceEngine(_ engine: DiscordVoiceEngine, didReceiveOpusVoiceData data: DiscordOpusVoiceData)
Parameters
didReceiveOpusVoiceData
A
DiscordOpusVoiceData
instance containing opus encoded voice data. -
Handles raw voice data received from a VoiceEngine
Declaration
Swift
open func voiceEngine(_ engine: DiscordVoiceEngine, didReceiveRawVoiceData data: DiscordRawVoiceData)
Parameters
didReceiveRawVoiceData
A
DiscordRawVoiceData
instance containing raw voice data. -
Called when the voice engine needs an encoder.
Declaration
Swift
open func voiceEngineNeedsDataSource(_ engine: DiscordVoiceEngine) throws -> DiscordVoiceDataSource?
Parameters
engine
The engine that needs an encoder
Return Value
An encoder.
-
Called when the voice engine is ready.
Declaration
Swift
open func voiceEngineReady(_ engine: DiscordVoiceEngine)
Parameters
engine
The engine that’s ready.