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>
|
/// </returns>
|
||||||
bool IsStreaming { get; }
|
bool IsStreaming { get; }
|
||||||
/// <summary>
|
/// <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.
|
/// Gets the time on which the user requested to speak.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
DateTimeOffset? RequestToSpeakTimestamp { get; }
|
DateTimeOffset? RequestToSpeakTimestamp { get; }
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ namespace Discord.API
|
|||||||
public bool Suppress { get; set; }
|
public bool Suppress { get; set; }
|
||||||
[JsonProperty("self_stream")]
|
[JsonProperty("self_stream")]
|
||||||
public bool SelfStream { get; set; }
|
public bool SelfStream { get; set; }
|
||||||
|
[JsonProperty("self_video")]
|
||||||
|
public bool SelfVideo { get; set; }
|
||||||
[JsonProperty("request_to_speak_timestamp")]
|
[JsonProperty("request_to_speak_timestamp")]
|
||||||
public Optional<DateTimeOffset?> RequestToSpeakTimestamp { get; set; }
|
public Optional<DateTimeOffset?> RequestToSpeakTimestamp { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ namespace Discord.Rest
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
bool IVoiceState.IsStreaming => false;
|
bool IVoiceState.IsStreaming => false;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
bool IVoiceState.IsVideoing => false;
|
||||||
|
/// <inheritdoc />
|
||||||
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,6 +223,8 @@ namespace Discord.Rest
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
bool IVoiceState.IsStreaming => false;
|
bool IVoiceState.IsStreaming => false;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
bool IVoiceState.IsVideoing => false;
|
||||||
|
/// <inheritdoc />
|
||||||
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,8 @@ namespace Discord.Rest
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
bool IVoiceState.IsStreaming => false;
|
bool IVoiceState.IsStreaming => false;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
bool IVoiceState.IsVideoing => false;
|
||||||
|
/// <inheritdoc />
|
||||||
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ namespace Discord.WebSocket
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
bool IVoiceState.IsStreaming => false;
|
bool IVoiceState.IsStreaming => false;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
bool IVoiceState.IsVideoing => false;
|
||||||
|
/// <inheritdoc />
|
||||||
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ namespace Discord.WebSocket
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool IsStreaming => VoiceState?.IsStreaming ?? false;
|
public bool IsStreaming => VoiceState?.IsStreaming ?? false;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
public bool IsVideoing => VoiceState?.IsVideoing ?? false;
|
||||||
|
/// <inheritdoc />
|
||||||
public DateTimeOffset? RequestToSpeakTimestamp => VoiceState?.RequestToSpeakTimestamp ?? null;
|
public DateTimeOffset? RequestToSpeakTimestamp => VoiceState?.RequestToSpeakTimestamp ?? null;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool? IsPending { get; private set; }
|
public bool? IsPending { get; private set; }
|
||||||
|
|||||||
@@ -122,6 +122,10 @@ namespace Discord.WebSocket
|
|||||||
public bool IsStreaming
|
public bool IsStreaming
|
||||||
=> GuildUser.IsStreaming;
|
=> GuildUser.IsStreaming;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public bool IsVideoing
|
||||||
|
=> GuildUser.IsVideoing;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public DateTimeOffset? RequestToSpeakTimestamp
|
public DateTimeOffset? RequestToSpeakTimestamp
|
||||||
=> GuildUser.RequestToSpeakTimestamp;
|
=> GuildUser.RequestToSpeakTimestamp;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Discord.WebSocket
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a default <see cref="SocketVoiceState"/> with everything set to <c>null</c> or <c>false</c>.
|
/// Initializes a default <see cref="SocketVoiceState"/> with everything set to <c>null</c> or <c>false</c>.
|
||||||
/// </summary>
|
/// </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]
|
[Flags]
|
||||||
private enum Flags : byte
|
private enum Flags : byte
|
||||||
@@ -25,6 +25,7 @@ namespace Discord.WebSocket
|
|||||||
SelfMuted = 0x08,
|
SelfMuted = 0x08,
|
||||||
SelfDeafened = 0x10,
|
SelfDeafened = 0x10,
|
||||||
SelfStream = 0x20,
|
SelfStream = 0x20,
|
||||||
|
SelfVideo = 0x40,
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Flags _voiceStates;
|
private readonly Flags _voiceStates;
|
||||||
@@ -50,9 +51,11 @@ namespace Discord.WebSocket
|
|||||||
public bool IsSelfDeafened => (_voiceStates & Flags.SelfDeafened) != 0;
|
public bool IsSelfDeafened => (_voiceStates & Flags.SelfDeafened) != 0;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool IsStreaming => (_voiceStates & Flags.SelfStream) != 0;
|
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;
|
VoiceChannel = voiceChannel;
|
||||||
VoiceSessionId = sessionId;
|
VoiceSessionId = sessionId;
|
||||||
@@ -71,11 +74,13 @@ namespace Discord.WebSocket
|
|||||||
voiceStates |= Flags.Suppressed;
|
voiceStates |= Flags.Suppressed;
|
||||||
if (isStream)
|
if (isStream)
|
||||||
voiceStates |= Flags.SelfStream;
|
voiceStates |= Flags.SelfStream;
|
||||||
|
if (isVideo)
|
||||||
|
voiceStates |= Flags.SelfVideo;
|
||||||
_voiceStates = voiceStates;
|
_voiceStates = voiceStates;
|
||||||
}
|
}
|
||||||
internal static SocketVoiceState Create(SocketVoiceChannel voiceChannel, Model model)
|
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>
|
/// <summary>
|
||||||
|
|||||||
@@ -164,6 +164,8 @@ namespace Discord.WebSocket
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
bool IVoiceState.IsStreaming => false;
|
bool IVoiceState.IsStreaming => false;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
bool IVoiceState.IsVideoing => false;
|
||||||
|
/// <inheritdoc />
|
||||||
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
DateTimeOffset? IVoiceState.RequestToSpeakTimestamp => null;
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user