feature: Add GuildUser IsPending property (#1731)
* Implemented Pending property * Implemented changes
This commit is contained in:
@@ -68,6 +68,11 @@ namespace Discord
|
||||
/// </returns>
|
||||
IReadOnlyCollection<ulong> RoleIds { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user has passed the guild's Membership Screening requirements.
|
||||
/// </summary>
|
||||
bool? IsPending { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the level permissions granted to this user to a given channel.
|
||||
/// </summary>
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace Discord.API
|
||||
public Optional<bool> Deaf { get; set; }
|
||||
[JsonProperty("mute")]
|
||||
public Optional<bool> Mute { get; set; }
|
||||
[JsonProperty("pending")]
|
||||
public Optional<bool> Pending { get; set; }
|
||||
[JsonProperty("premium_since")]
|
||||
public Optional<DateTimeOffset?> PremiumSince { get; set; }
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace Discord.Rest
|
||||
public DateTimeOffset? PremiumSince => DateTimeUtils.FromTicks(_premiumSinceTicks);
|
||||
/// <inheritdoc />
|
||||
public ulong GuildId => Guild.Id;
|
||||
/// <inheritdoc />
|
||||
public bool? IsPending { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <exception cref="InvalidOperationException" accessor="get">Resolving permissions requires the parent guild to be downloaded.</exception>
|
||||
@@ -73,6 +75,8 @@ namespace Discord.Rest
|
||||
UpdateRoles(model.Roles.Value);
|
||||
if (model.PremiumSince.IsSpecified)
|
||||
_premiumSinceTicks = model.PremiumSince.Value?.UtcTicks;
|
||||
if (model.Pending.IsSpecified)
|
||||
IsPending = model.Pending.Value;
|
||||
}
|
||||
private void UpdateRoles(ulong[] roleIds)
|
||||
{
|
||||
|
||||
@@ -52,6 +52,8 @@ namespace Discord.Rest
|
||||
/// <inheritdoc />
|
||||
string IGuildUser.Nickname => null;
|
||||
/// <inheritdoc />
|
||||
bool? IGuildUser.IsPending => null;
|
||||
/// <inheritdoc />
|
||||
GuildPermissions IGuildUser.GuildPermissions => GuildPermissions.Webhook;
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -57,6 +57,8 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc />
|
||||
public bool IsStreaming => VoiceState?.IsStreaming ?? false;
|
||||
/// <inheritdoc />
|
||||
public bool? IsPending { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public DateTimeOffset? JoinedAt => DateTimeUtils.FromTicks(_joinedAtTicks);
|
||||
/// <summary>
|
||||
/// Returns a collection of roles that the user possesses.
|
||||
@@ -142,6 +144,8 @@ namespace Discord.WebSocket
|
||||
UpdateRoles(model.Roles.Value);
|
||||
if (model.PremiumSince.IsSpecified)
|
||||
_premiumSinceTicks = model.PremiumSince.Value?.UtcTicks;
|
||||
if (model.Pending.IsSpecified)
|
||||
IsPending = model.Pending.Value;
|
||||
}
|
||||
internal void Update(ClientState state, PresenceModel model, bool updatePresence)
|
||||
{
|
||||
|
||||
@@ -65,6 +65,8 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc />
|
||||
DateTimeOffset? IGuildUser.PremiumSince => null;
|
||||
/// <inheritdoc />
|
||||
bool? IGuildUser.IsPending => null;
|
||||
/// <inheritdoc />
|
||||
GuildPermissions IGuildUser.GuildPermissions => GuildPermissions.Webhook;
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user