Browse Source

fix: Grab correct Uses value for vanity urls (#1832)

tags/3.0.0
Evan Raffel GitHub 4 years ago
parent
commit
8ed8714375
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions
  1. +2
    -0
      src/Discord.Net.Rest/API/Common/InviteVanity.cs
  2. +1
    -0
      src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs

+ 2
- 0
src/Discord.Net.Rest/API/Common/InviteVanity.cs View File

@@ -6,5 +6,7 @@ namespace Discord.API
{
[JsonProperty("code")]
public string Code { get; set; }
[JsonProperty("uses")]
public int Uses { get; set; }
}
}

+ 1
- 0
src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs View File

@@ -283,6 +283,7 @@ namespace Discord.Rest
var vanityModel = await client.ApiClient.GetVanityInviteAsync(guild.Id, options).ConfigureAwait(false);
if (vanityModel == null) throw new InvalidOperationException("This guild does not have a vanity URL.");
var inviteModel = await client.ApiClient.GetInviteAsync(vanityModel.Code, options).ConfigureAwait(false);
inviteModel.Uses = vanityModel.Uses;
return RestInviteMetadata.Create(client, guild, null, inviteModel);
}



Loading…
Cancel
Save