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:
@@ -56,7 +56,7 @@ namespace Discord.WebSocket
|
||||
=> ClientHelper.GetConnectionsAsync(this, options ?? RequestOptions.Default);
|
||||
/// <inheritdoc />
|
||||
public Task<RestInviteMetadata> GetInviteAsync(string inviteId, bool withCount = false, RequestOptions options = null)
|
||||
=> ClientHelper.GetInviteAsync(this, inviteId, withCount, options ?? RequestOptions.Default);
|
||||
=> ClientHelper.GetInviteAsync(this, inviteId, options ?? RequestOptions.Default);
|
||||
|
||||
// IDiscordClient
|
||||
async Task<IApplication> IDiscordClient.GetApplicationInfoAsync(RequestOptions options)
|
||||
|
||||
@@ -345,6 +345,15 @@ namespace Discord.WebSocket
|
||||
//Invites
|
||||
public Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null)
|
||||
=> GuildHelper.GetInvitesAsync(this, Discord, options);
|
||||
/// <summary>
|
||||
/// Gets the vanity invite URL of this guild.
|
||||
/// </summary>
|
||||
/// <param name="options">The options to be used when sending the request.</param>
|
||||
/// <returns>
|
||||
/// A partial metadata of the vanity invite found within this guild.
|
||||
/// </returns>
|
||||
public Task<RestInviteMetadata> GetVanityInviteAsync(RequestOptions options = null)
|
||||
=> GuildHelper.GetVanityInviteAsync(this, Discord, options);
|
||||
|
||||
//Roles
|
||||
public SocketRole GetRole(ulong id)
|
||||
@@ -700,6 +709,9 @@ namespace Discord.WebSocket
|
||||
|
||||
async Task<IReadOnlyCollection<IInviteMetadata>> IGuild.GetInvitesAsync(RequestOptions options)
|
||||
=> await GetInvitesAsync(options).ConfigureAwait(false);
|
||||
/// <inheritdoc />
|
||||
async Task<IInviteMetadata> IGuild.GetVanityInviteAsync(RequestOptions options)
|
||||
=> await GetVanityInviteAsync(options).ConfigureAwait(false);
|
||||
|
||||
IRole IGuild.GetRole(ulong id)
|
||||
=> GetRole(id);
|
||||
|
||||
Reference in New Issue
Block a user