Class VoiceClient
public class VoiceClient : WebSocketClient, IDisposable
- Inheritance
-
VoiceClient
- Implements
- Inherited Members
Constructors
VoiceClient(ulong, string, string, ulong, string, VoiceClientConfiguration?)
public VoiceClient(ulong userId, string sessionId, string endpoint, ulong guildId, string token, VoiceClientConfiguration? configuration = null)
Parameters
userId
ulongsessionId
stringendpoint
stringguildId
ulongtoken
stringconfiguration
VoiceClientConfiguration
Properties
Cache
The cache of the VoiceClient.
public IVoiceClientCache Cache { get; }
Property Value
Endpoint
public string Endpoint { get; }
Property Value
GuildId
public ulong GuildId { get; }
Property Value
RedirectInputStreams
public bool RedirectInputStreams { get; }
Property Value
SequenceNumber
The sequence number of the VoiceClient.
public int SequenceNumber { get; }
Property Value
SessionId
public string SessionId { get; }
Property Value
Token
public string Token { get; }
Property Value
UserId
public ulong UserId { get; }
Property Value
Methods
CreateOutputStream(bool)
Creates a stream that you can write to to send voice. Each write must be exactly one Opus frame.
public Stream CreateOutputStream(bool normalizeSpeed = true)
Parameters
normalizeSpeed
boolWhether to normalize the voice sending speed.
Returns
Exceptions
- InvalidOperationException
Used before Ready event.
Dispose(bool)
protected override void Dispose(bool disposing)
Parameters
disposing
bool
EnterSpeakingStateAsync(SpeakingFlags, int, WebSocketPayloadProperties?, CancellationToken)
public ValueTask EnterSpeakingStateAsync(SpeakingFlags flags, int delay = 0, WebSocketPayloadProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
flags
SpeakingFlagsdelay
intproperties
WebSocketPayloadPropertiescancellationToken
CancellationToken
Returns
ResumeAsync(int, CancellationToken)
Resumes the session.
public Task ResumeAsync(int sequenceNumber, CancellationToken cancellationToken = default)
Parameters
sequenceNumber
intThe sequence number of the payload to resume from.
cancellationToken
CancellationTokenThe cancellation token to cancel the operation.
Returns
StartAsync(CancellationToken)
Starts the VoiceClient.
public Task StartAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationToken
Returns
Events
Ready
public event Func<ValueTask>? Ready
Event Type
UserConnect
public event Func<UserConnectEventArgs, ValueTask>? UserConnect
Event Type
UserDisconnect
public event Func<UserDisconnectEventArgs, ValueTask>? UserDisconnect
Event Type
VoiceReceive
public event Func<VoiceReceiveEventArgs, ValueTask>? VoiceReceive