|
|
@@ -13,7 +13,7 @@ namespace Discord.WebSocket |
|
|
|
/// <summary> |
|
|
|
/// Initializes a default <see cref="SocketVoiceState"/> with everything set to <c>null</c> or <c>false</c>. |
|
|
|
/// </summary> |
|
|
|
public static readonly SocketVoiceState Default = new SocketVoiceState(null, null, null, false, false, false, false, false, false); |
|
|
|
public static readonly SocketVoiceState Default = new SocketVoiceState(null, null, null, false, false, false, false, false, false, false); |
|
|
|
|
|
|
|
[Flags] |
|
|
|
private enum Flags : byte |
|
|
@@ -25,6 +25,7 @@ namespace Discord.WebSocket |
|
|
|
SelfMuted = 0x08, |
|
|
|
SelfDeafened = 0x10, |
|
|
|
SelfStream = 0x20, |
|
|
|
SelfVideo = 0x40, |
|
|
|
} |
|
|
|
|
|
|
|
private readonly Flags _voiceStates; |
|
|
@@ -50,9 +51,11 @@ namespace Discord.WebSocket |
|
|
|
public bool IsSelfDeafened => (_voiceStates & Flags.SelfDeafened) != 0; |
|
|
|
/// <inheritdoc /> |
|
|
|
public bool IsStreaming => (_voiceStates & Flags.SelfStream) != 0; |
|
|
|
/// <inheritdoc /> |
|
|
|
public bool IsVideoing => (_voiceStates & Flags.SelfVideo) != 0; |
|
|
|
|
|
|
|
|
|
|
|
internal SocketVoiceState(SocketVoiceChannel voiceChannel, DateTimeOffset? requestToSpeak, string sessionId, bool isSelfMuted, bool isSelfDeafened, bool isMuted, bool isDeafened, bool isSuppressed, bool isStream) |
|
|
|
internal SocketVoiceState(SocketVoiceChannel voiceChannel, DateTimeOffset? requestToSpeak, string sessionId, bool isSelfMuted, bool isSelfDeafened, bool isMuted, bool isDeafened, bool isSuppressed, bool isStream, bool isVideo) |
|
|
|
{ |
|
|
|
VoiceChannel = voiceChannel; |
|
|
|
VoiceSessionId = sessionId; |
|
|
@@ -71,11 +74,13 @@ namespace Discord.WebSocket |
|
|
|
voiceStates |= Flags.Suppressed; |
|
|
|
if (isStream) |
|
|
|
voiceStates |= Flags.SelfStream; |
|
|
|
if (isVideo) |
|
|
|
voiceStates |= Flags.SelfVideo; |
|
|
|
_voiceStates = voiceStates; |
|
|
|
} |
|
|
|
internal static SocketVoiceState Create(SocketVoiceChannel voiceChannel, Model model) |
|
|
|
{ |
|
|
|
return new SocketVoiceState(voiceChannel, model.RequestToSpeakTimestamp.IsSpecified ? model.RequestToSpeakTimestamp.Value : null, model.SessionId, model.SelfMute, model.SelfDeaf, model.Mute, model.Deaf, model.Suppress, model.SelfStream); |
|
|
|
return new SocketVoiceState(voiceChannel, model.RequestToSpeakTimestamp.IsSpecified ? model.RequestToSpeakTimestamp.Value : null, model.SessionId, model.SelfMute, model.SelfDeaf, model.Mute, model.Deaf, model.Suppress, model.SelfStream, model.SelfVideo); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|