| @@ -26,8 +26,5 @@ namespace Discord | |||||
| int? PresenceCount { get; } | int? PresenceCount { get; } | ||||
| /// <summary> Gets the approximated count of total members in the guild. </summary> | /// <summary> Gets the approximated count of total members in the guild. </summary> | ||||
| int? MemberCount { get; } | int? MemberCount { get; } | ||||
| /// <summary> Accepts this invite and joins the target guild. This will fail on bot accounts. </summary> | |||||
| Task AcceptAsync(RequestOptions options = null); | |||||
| } | } | ||||
| } | } | ||||
| @@ -952,13 +952,6 @@ namespace Discord.API | |||||
| return await SendAsync<Invite>("DELETE", () => $"invites/{inviteId}", new BucketIds(), options: options).ConfigureAwait(false); | return await SendAsync<Invite>("DELETE", () => $"invites/{inviteId}", new BucketIds(), options: options).ConfigureAwait(false); | ||||
| } | } | ||||
| public async Task AcceptInviteAsync(string inviteId, RequestOptions options = null) | |||||
| { | |||||
| Preconditions.NotNullOrEmpty(inviteId, nameof(inviteId)); | |||||
| options = RequestOptions.CreateOrClone(options); | |||||
| await SendAsync("POST", () => $"invites/{inviteId}", new BucketIds(), options: options).ConfigureAwait(false); | |||||
| } | |||||
| //Guild Members | //Guild Members | ||||
| public async Task<GuildMember> GetGuildMemberAsync(ulong guildId, ulong userId, RequestOptions options = null) | public async Task<GuildMember> GetGuildMemberAsync(ulong guildId, ulong userId, RequestOptions options = null) | ||||
| @@ -1,14 +1,9 @@ | |||||
| using System.Threading.Tasks; | |||||
| using System.Threading.Tasks; | |||||
| namespace Discord.Rest | namespace Discord.Rest | ||||
| { | { | ||||
| internal static class InviteHelper | internal static class InviteHelper | ||||
| { | { | ||||
| public static async Task AcceptAsync(IInvite invite, BaseDiscordClient client, | |||||
| RequestOptions options) | |||||
| { | |||||
| await client.ApiClient.AcceptInviteAsync(invite.Code, options).ConfigureAwait(false); | |||||
| } | |||||
| public static async Task DeleteAsync(IInvite invite, BaseDiscordClient client, | public static async Task DeleteAsync(IInvite invite, BaseDiscordClient client, | ||||
| RequestOptions options) | RequestOptions options) | ||||
| { | { | ||||
| @@ -54,9 +54,6 @@ namespace Discord.Rest | |||||
| public Task DeleteAsync(RequestOptions options = null) | public Task DeleteAsync(RequestOptions options = null) | ||||
| => InviteHelper.DeleteAsync(this, Discord, options); | => InviteHelper.DeleteAsync(this, Discord, options); | ||||
| public Task AcceptAsync(RequestOptions options = null) | |||||
| => InviteHelper.AcceptAsync(this, Discord, options); | |||||
| public override string ToString() => Url; | public override string ToString() => Url; | ||||
| private string DebuggerDisplay => $"{Url} ({GuildName} / {ChannelName})"; | private string DebuggerDisplay => $"{Url} ({GuildName} / {ChannelName})"; | ||||