Skip to content

Commit

Permalink
fix: Grab correct Uses value for vanity urls (#1832)
Browse files Browse the repository at this point in the history
  • Loading branch information
evman182 committed May 26, 2021
1 parent 70aab6c commit 8ed8714
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Discord.Net.Rest/API/Common/InviteVanity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ public class InviteVanity
{
[JsonProperty("code")]
public string Code { get; set; }
[JsonProperty("uses")]
public int Uses { get; set; }
}
}
1 change: 1 addition & 0 deletions src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ public static async Task<RestBan> GetBanAsync(IGuild guild, BaseDiscordClient cl
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);
}

Expand Down

0 comments on commit 8ed8714

Please sign in to comment.