Fix/Implement various invite-related behaviors (#1023)
* Initial support for invite member count arg * Fix IDiscordClient#GetInviteAsync behavior - Previously, the GetInviteAsync method would return null since it couldn't be parsed as a simple RestInvite object. The object should be a RestInviteMetadata instead. * Fix methods that didn't comply with the interface * Change with_counts REST behaviour * Remove unnecessary JSON prop * Remove AcceptAsync
This commit is contained in:
@@ -50,12 +50,16 @@ namespace Discord.Rest
|
||||
return models.Select(x => RestConnection.Create(x)).ToImmutableArray();
|
||||
}
|
||||
|
||||
public static async Task<RestInvite> GetInviteAsync(BaseDiscordClient client,
|
||||
string inviteId, RequestOptions options)
|
||||
public static async Task<RestInviteMetadata> GetInviteAsync(BaseDiscordClient client,
|
||||
string inviteId, bool withCount, RequestOptions options)
|
||||
{
|
||||
var model = await client.ApiClient.GetInviteAsync(inviteId, options).ConfigureAwait(false);
|
||||
var args = new GetInviteParams
|
||||
{
|
||||
WithCounts = withCount
|
||||
};
|
||||
var model = await client.ApiClient.GetInviteAsync(inviteId, args, options).ConfigureAwait(false);
|
||||
if (model != null)
|
||||
return RestInvite.Create(client, null, null, model);
|
||||
return RestInviteMetadata.Create(client, null, null, model);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user