Add self_video to VoiceState (#2137)
* Add self_video to VoiceState * Update selfVideo flag
This commit is contained in:
@@ -65,6 +65,13 @@ namespace Discord
|
||||
/// </returns>
|
||||
bool IsStreaming { get; }
|
||||
/// <summary>
|
||||
/// Gets a value that indicates if the user is videoing in a voice channel.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// <c>true</c> if the user has their camera turned on; otherwise <c>false</c>.
|
||||
/// </returns>
|
||||
bool IsVideoing { get; }
|
||||
/// <summary>
|
||||
/// Gets the time on which the user requested to speak.
|
||||
/// </summary>
|
||||
DateTimeOffset? RequestToSpeakTimestamp { get; }
|
||||
|
||||
@@ -28,6 +28,8 @@ namespace Discord.API
|
||||
public bool Suppress { get; set; }
|
||||
[JsonProperty("self_stream")]
|
||||
public bool SelfStream { get; set; }
|
||||
[JsonProperty("self_video")]
|
||||
public bool SelfVideo { get; set; }
|
||||
[JsonProperty("request_to_speak_timestamp")]
|
||||
public Optional<DateTimeOffset?> RequestToSpeakTimestamp { get; set; }
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ namespace Discord.Rest
|
||||
/// <inheritdoc />
|
||||
bool IVoiceState.IsStreaming => false;
|
||||
/// <inheritdoc />
|
||||
bool IVoiceState.IsVideoing => false;
|
||||
/// <inheritdoc />
|
||||
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -223,6 +223,8 @@ namespace Discord.Rest
|
||||
/// <inheritdoc />
|
||||
bool IVoiceState.IsStreaming => false;
|
||||
/// <inheritdoc />
|
||||
bool IVoiceState.IsVideoing => false;
|
||||
/// <inheritdoc />
|
||||
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -131,6 +131,8 @@ namespace Discord.Rest
|
||||
/// <inheritdoc />
|
||||
bool IVoiceState.IsStreaming => false;
|
||||
/// <inheritdoc />
|
||||
bool IVoiceState.IsVideoing => false;
|
||||
/// <inheritdoc />
|
||||
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc />
|
||||
bool IVoiceState.IsStreaming => false;
|
||||
/// <inheritdoc />
|
||||
bool IVoiceState.IsVideoing => false;
|
||||
/// <inheritdoc />
|
||||
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc />
|
||||
public bool IsStreaming => VoiceState?.IsStreaming ?? false;
|
||||
/// <inheritdoc />
|
||||
public bool IsVideoing => VoiceState?.IsVideoing ?? false;
|
||||
/// <inheritdoc />
|
||||
public DateTimeOffset? RequestToSpeakTimestamp => VoiceState?.RequestToSpeakTimestamp ?? null;
|
||||
/// <inheritdoc />
|
||||
public bool? IsPending { get; private set; }
|
||||
|
||||
@@ -122,6 +122,10 @@ namespace Discord.WebSocket
|
||||
public bool IsStreaming
|
||||
=> GuildUser.IsStreaming;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsVideoing
|
||||
=> GuildUser.IsVideoing;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public DateTimeOffset? RequestToSpeakTimestamp
|
||||
=> GuildUser.RequestToSpeakTimestamp;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -164,6 +164,8 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc />
|
||||
bool IVoiceState.IsStreaming => false;
|
||||
/// <inheritdoc />
|
||||
bool IVoiceState.IsVideoing => false;
|
||||
/// <inheritdoc />
|
||||
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user