Browse Source

Mark guild as optional for invite

pull/1094/head
Still Hsu 7 years ago
parent
commit
f74cc9bf33
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
3 changed files with 5 additions and 5 deletions
  1. +1
    -1
      src/Discord.Net.Core/Entities/Invites/IInvite.cs
  2. +1
    -1
      src/Discord.Net.Rest/API/Common/Invite.cs
  3. +3
    -3
      src/Discord.Net.Rest/Entities/Invites/RestInvite.cs

+ 1
- 1
src/Discord.Net.Core/Entities/Invites/IInvite.cs View File

@@ -19,7 +19,7 @@ namespace Discord
/// <summary> Gets the guild this invite is linked to. </summary>
IGuild Guild { get; }
/// <summary> Gets the id of the guild this invite is linked to. </summary>
ulong GuildId { get; }
ulong? GuildId { get; }
/// <summary> Gets the name of the guild this invite is linked to. </summary>
string GuildName { get; }
/// <summary> Gets the approximated count of online members in the guild. </summary>


+ 1
- 1
src/Discord.Net.Rest/API/Common/Invite.cs View File

@@ -8,7 +8,7 @@ namespace Discord.API
[JsonProperty("code")]
public string Code { get; set; }
[JsonProperty("guild")]
public InviteGuild Guild { get; set; }
public Optional<InviteGuild> Guild { get; set; }
[JsonProperty("channel")]
public InviteChannel Channel { get; set; }
[JsonProperty("approximate_presence_count")]


+ 3
- 3
src/Discord.Net.Rest/Entities/Invites/RestInvite.cs View File

@@ -14,7 +14,7 @@ namespace Discord.Rest
public int? PresenceCount { get; private set; }
public int? MemberCount { get; private set; }
public ulong ChannelId { get; private set; }
public ulong GuildId { get; private set; }
public ulong? GuildId { get; private set; }
internal IChannel Channel { get; private set; }
internal IGuild Guild { get; private set; }

@@ -35,9 +35,9 @@ namespace Discord.Rest
}
internal void Update(Model model)
{
GuildId = model.Guild.Id;
GuildId = model.Guild.IsSpecified ? model.Guild.Value.Id : default(ulong?);
ChannelId = model.Channel.Id;
GuildName = model.Guild.Name;
GuildName = model.Guild.IsSpecified ? model.Guild.Value.Name : null;
ChannelName = model.Channel.Name;
MemberCount = model.MemberCount.IsSpecified ? model.MemberCount.Value : null;
PresenceCount = model.PresenceCount.IsSpecified ? model.PresenceCount.Value : null;


Loading…
Cancel
Save