Missing invite properties (#2615)

This commit is contained in:
Misha133
2023-02-27 16:06:58 +03:00
committed by GitHub
parent 76bb9018c4
commit abfa8d1751
15 changed files with 146 additions and 13 deletions

View File

@@ -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/>

View File

@@ -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
}
}