Initial fix (#1160)

This commit is contained in:
Still Hsu
2018-10-01 05:09:32 +08:00
committed by Christopher F
parent de4d415053
commit c9ba79ec80
3 changed files with 16 additions and 4 deletions

View File

@@ -213,8 +213,10 @@ namespace Discord.Rest
public static async Task<RestInviteMetadata> GetVanityInviteAsync(IGuild guild, BaseDiscordClient client,
RequestOptions options)
{
var model = await client.ApiClient.GetVanityInviteAsync(guild.Id, options).ConfigureAwait(false);
return RestInviteMetadata.Create(client, guild, null, model);
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);
return RestInviteMetadata.Create(client, guild, null, inviteModel);
}
//Roles