diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs index f58b0fe7f..11860629a 100644 --- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs +++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs @@ -424,13 +424,11 @@ namespace Discord /// /// /// The amount of bans to get from the guild. - /// The that determines whether the object should be fetched from - /// cache. /// The options to be used when sending the request. /// /// A paged collection of bans. /// - IAsyncEnumerable> GetBansAsync(int limit = DiscordConfig.MaxBansPerBatch, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); + IAsyncEnumerable> GetBansAsync(int limit = DiscordConfig.MaxBansPerBatch, RequestOptions options = null); /// /// Gets amount of bans from the guild starting at the provided /// @@ -448,13 +446,11 @@ namespace Discord /// The ID of the user to start to get bans from. /// The direction of the bans to be gotten. /// The number of bans to get. - /// The that determines whether the object should be fetched from - /// cache. /// The options to be used when sending the request. /// /// A paged collection of bans. /// - IAsyncEnumerable> GetBansAsync(ulong fromUserId, Direction dir, int limit = DiscordConfig.MaxBansPerBatch, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); + IAsyncEnumerable> GetBansAsync(ulong fromUserId, Direction dir, int limit = DiscordConfig.MaxBansPerBatch, RequestOptions options = null); /// /// Gets amount of bans from the guild starting at the provided /// @@ -472,13 +468,11 @@ namespace Discord /// The user to start to get bans from. /// The direction of the bans to be gotten. /// The number of bans to get. - /// The that determines whether the object should be fetched from - /// cache. /// The options to be used when sending the request. /// /// A paged collection of bans. /// - IAsyncEnumerable> GetBansAsync(IUser fromUser, Direction dir, int limit = DiscordConfig.MaxBansPerBatch, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); + IAsyncEnumerable> GetBansAsync(IUser fromUser, Direction dir, int limit = DiscordConfig.MaxBansPerBatch, RequestOptions options = null); /// /// Gets a ban object for a banned user. /// diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs index 7f63fff86..f4a2364df 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs @@ -1263,35 +1263,14 @@ namespace Discord.Rest async Task> IGuild.GetEventsAsync(RequestOptions options) => await GetEventsAsync(options).ConfigureAwait(false); /// - IAsyncEnumerable> IGuild.GetBansAsync(int limit, CacheMode mode, RequestOptions options) - { - if (mode == CacheMode.AllowDownload) - { - return GetBansAsync(limit, options); - } - else - return AsyncEnumerable.Empty>(); - } + IAsyncEnumerable> IGuild.GetBansAsync(int limit, RequestOptions options) + => GetBansAsync(limit, options); /// - IAsyncEnumerable> IGuild.GetBansAsync(ulong fromUserId, Direction dir, int limit, CacheMode mode, RequestOptions options) - { - if (mode == CacheMode.AllowDownload) - { - return GetBansAsync(fromUserId, dir, limit, options); - } - else - return AsyncEnumerable.Empty>(); - } + IAsyncEnumerable> IGuild.GetBansAsync(ulong fromUserId, Direction dir, int limit, RequestOptions options) + => GetBansAsync(fromUserId, dir, limit, options); /// - IAsyncEnumerable> IGuild.GetBansAsync(IUser fromUser, Direction dir, int limit, CacheMode mode, RequestOptions options) - { - if (mode == CacheMode.AllowDownload) - { - return GetBansAsync(fromUser, dir, limit, options); - } - else - return AsyncEnumerable.Empty>(); - } + IAsyncEnumerable> IGuild.GetBansAsync(IUser fromUser, Direction dir, int limit, RequestOptions options) + => GetBansAsync(fromUser, dir, limit, options); /// async Task IGuild.GetBanAsync(IUser user, RequestOptions options) => await GetBanAsync(user, options).ConfigureAwait(false); diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs index 30c01d1a6..7a02861ba 100644 --- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs +++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs @@ -637,13 +637,11 @@ namespace Discord.WebSocket /// /// /// The number of bans to get. - /// The that determines whether the object should be fetched from - /// cache. /// The options to be used when sending the request. /// /// A paged collection of bans. /// - public IAsyncEnumerable> GetBansAsync(int limit = DiscordConfig.MaxBansPerBatch, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) + public IAsyncEnumerable> GetBansAsync(int limit = DiscordConfig.MaxBansPerBatch, RequestOptions options = null) => GuildHelper.GetBansAsync(this, Discord, null, Direction.Before, limit, options); /// @@ -663,13 +661,11 @@ namespace Discord.WebSocket /// The ID of the user to start to get bans from. /// The direction of the bans to be gotten. /// The number of bans to get. - /// The that determines whether the object should be fetched from - /// cache. /// The options to be used when sending the request. /// /// A paged collection of bans. /// - public IAsyncEnumerable> GetBansAsync(ulong fromUserId, Direction dir, int limit = DiscordConfig.MaxBansPerBatch, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) + public IAsyncEnumerable> GetBansAsync(ulong fromUserId, Direction dir, int limit = DiscordConfig.MaxBansPerBatch, RequestOptions options = null) => GuildHelper.GetBansAsync(this, Discord, fromUserId, dir, limit, options); /// @@ -689,13 +685,11 @@ namespace Discord.WebSocket /// The user to start to get bans from. /// The direction of the bans to be gotten. /// The number of bans to get. - /// The that determines whether the object should be fetched from - /// cache. /// The options to be used when sending the request. /// /// A paged collection of bans. /// - public IAsyncEnumerable> GetBansAsync(IUser fromUser, Direction dir, int limit = DiscordConfig.MaxBansPerBatch, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) + public IAsyncEnumerable> GetBansAsync(IUser fromUser, Direction dir, int limit = DiscordConfig.MaxBansPerBatch, RequestOptions options = null) => GuildHelper.GetBansAsync(this, Discord, fromUser.Id, dir, limit, options); /// @@ -1876,36 +1870,14 @@ namespace Discord.WebSocket async Task> IGuild.GetEventsAsync(RequestOptions options) => await GetEventsAsync(options).ConfigureAwait(false); /// + IAsyncEnumerable> IGuild.GetBansAsync(int limit, RequestOptions options) + => GetBansAsync(limit, options); /// - IAsyncEnumerable> IGuild.GetBansAsync(int limit, CacheMode mode, RequestOptions options) - { - if (mode == CacheMode.AllowDownload) - { - return GetBansAsync(limit, options); - } - else - return AsyncEnumerable.Empty>(); - } + IAsyncEnumerable> IGuild.GetBansAsync(ulong fromUserId, Direction dir, int limit, RequestOptions options) + => GetBansAsync(fromUserId, dir, limit, options); /// - IAsyncEnumerable> IGuild.GetBansAsync(ulong fromUserId, Direction dir, int limit, CacheMode mode, RequestOptions options) - { - if (mode == CacheMode.AllowDownload) - { - return GetBansAsync(fromUserId, dir, limit, options); - } - else - return AsyncEnumerable.Empty>(); - } - /// - IAsyncEnumerable> IGuild.GetBansAsync(IUser fromUser, Direction dir, int limit, CacheMode mode, RequestOptions options) - { - if (mode == CacheMode.AllowDownload) - { - return GetBansAsync(fromUser, dir, limit, options); - } - else - return AsyncEnumerable.Empty>(); - } + IAsyncEnumerable> IGuild.GetBansAsync(IUser fromUser, Direction dir, int limit, RequestOptions options) + => GetBansAsync(fromUser, dir, limit, options); /// async Task IGuild.GetBanAsync(IUser user, RequestOptions options) => await GetBanAsync(user, options).ConfigureAwait(false);