Missing invite properties (#2615)
This commit is contained in:
@@ -21,11 +21,17 @@ namespace Discord.API.Gateway
|
||||
public int MaxUses { get; set; }
|
||||
[JsonProperty("target_user")]
|
||||
public Optional<User> TargetUser { get; set; }
|
||||
[JsonProperty("target_user_type")]
|
||||
[JsonProperty("target_type")]
|
||||
public Optional<TargetUserType> TargetUserType { get; set; }
|
||||
[JsonProperty("temporary")]
|
||||
public bool Temporary { get; set; }
|
||||
[JsonProperty("uses")]
|
||||
public int Uses { get; set; }
|
||||
|
||||
[JsonProperty("target_application")]
|
||||
public Optional<Application> Application { get; set; }
|
||||
|
||||
[JsonProperty("expires_at")]
|
||||
public Optional<DateTimeOffset?> ExpiresAt { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,11 +268,12 @@ namespace Discord.WebSocket
|
||||
/// </summary>
|
||||
/// <param name="inviteId">The invitation identifier.</param>
|
||||
/// <param name="options">The options to be used when sending the request.</param>
|
||||
/// <param name="scheduledEventId">The id of the guild scheduled event to include with the invite.</param>
|
||||
/// <returns>
|
||||
/// A task that represents the asynchronous get operation. The task result contains the invite information.
|
||||
/// </returns>
|
||||
public Task<RestInviteMetadata> GetInviteAsync(string inviteId, RequestOptions options = null)
|
||||
=> ClientHelper.GetInviteAsync(this, inviteId, options ?? RequestOptions.Default);
|
||||
public Task<RestInviteMetadata> GetInviteAsync(string inviteId, RequestOptions options = null, ulong? scheduledEventId = null)
|
||||
=> ClientHelper.GetInviteAsync(this, inviteId, options ?? RequestOptions.Default, scheduledEventId);
|
||||
/// <summary>
|
||||
/// Gets a sticker.
|
||||
/// </summary>
|
||||
|
||||
@@ -19,6 +19,9 @@ namespace Discord.WebSocket
|
||||
/// </summary>
|
||||
public SocketGuild Guild { get; private set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ulong GuildId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the channel of the event.
|
||||
/// </summary>
|
||||
@@ -113,6 +116,7 @@ namespace Discord.WebSocket
|
||||
Status = model.Status;
|
||||
UserCount = model.UserCount.ToNullable();
|
||||
CoverImageId = model.Image;
|
||||
GuildId = model.GuildId;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -90,6 +90,12 @@ namespace Discord.WebSocket
|
||||
/// </summary>
|
||||
public TargetUserType TargetUserType { get; private set; }
|
||||
|
||||
/// <inheritdoc cref="IInvite.Application" />
|
||||
public RestApplication Application { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public DateTimeOffset? ExpiresAt { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Code => Id;
|
||||
/// <inheritdoc />
|
||||
@@ -119,6 +125,8 @@ namespace Discord.WebSocket
|
||||
Uses = model.Uses;
|
||||
_createdAtTicks = model.CreatedAt.UtcTicks;
|
||||
TargetUserType = model.TargetUserType.IsSpecified ? model.TargetUserType.Value : TargetUserType.Undefined;
|
||||
ExpiresAt = model.ExpiresAt.IsSpecified ? model.ExpiresAt.Value : null;
|
||||
Application = model.Application.IsSpecified ? RestApplication.Create(Discord, model.Application.Value) : null;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -134,6 +142,8 @@ namespace Discord.WebSocket
|
||||
public override string ToString() => Url;
|
||||
private string DebuggerDisplay => $"{Url} ({Guild?.Name} / {Channel.Name})";
|
||||
|
||||
#region IInvite
|
||||
|
||||
/// <inheritdoc />
|
||||
IGuild IInvite.Guild => Guild;
|
||||
/// <inheritdoc />
|
||||
@@ -142,5 +152,10 @@ namespace Discord.WebSocket
|
||||
IUser IInvite.Inviter => Inviter;
|
||||
/// <inheritdoc />
|
||||
IUser IInvite.TargetUser => TargetUser;
|
||||
|
||||
/// <inheritdoc />
|
||||
IApplication IInvite.Application => Application;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user