Mark guild optional in invite & general invite improvement (#1094)

* Mark guild as optional for invite

* Mark partial InviteMetadata members as Optional<T>

* Some of them aren't sent when requesting through the general GET invite endpoint

* Remove GetInviteParams

* It was kinda stupid in the first place, might as well always get the count instead of having to ask the user whether they want the two fields filled or not.

* Add ChannelType property

* Add vanity invite support
This commit is contained in:
Still Hsu
2018-07-03 05:02:38 +08:00
committed by Christopher F
parent 4bc06a0a54
commit ffe994a9df
17 changed files with 84 additions and 52 deletions

View File

@@ -210,6 +210,12 @@ namespace Discord.Rest
var models = await client.ApiClient.GetGuildInvitesAsync(guild.Id, options).ConfigureAwait(false);
return models.Select(x => RestInviteMetadata.Create(client, guild, null, x)).ToImmutableArray();
}
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);
}
//Roles
public static async Task<RestRole> CreateRoleAsync(IGuild guild, BaseDiscordClient client,