fix: Grab correct Uses value for vanity urls (#1832)
This commit is contained in:
@@ -6,5 +6,7 @@ namespace Discord.API
|
|||||||
{
|
{
|
||||||
[JsonProperty("code")]
|
[JsonProperty("code")]
|
||||||
public string Code { get; set; }
|
public string Code { get; set; }
|
||||||
|
[JsonProperty("uses")]
|
||||||
|
public int Uses { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,6 +283,7 @@ namespace Discord.Rest
|
|||||||
var vanityModel = await client.ApiClient.GetVanityInviteAsync(guild.Id, options).ConfigureAwait(false);
|
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.");
|
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);
|
var inviteModel = await client.ApiClient.GetInviteAsync(vanityModel.Code, options).ConfigureAwait(false);
|
||||||
|
inviteModel.Uses = vanityModel.Uses;
|
||||||
return RestInviteMetadata.Create(client, guild, null, inviteModel);
|
return RestInviteMetadata.Create(client, guild, null, inviteModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user