diff --git a/src/Discord.Net.Core/RequestOptions.cs b/src/Discord.Net.Core/RequestOptions.cs index 5f3a8814b..3a3141157 100644 --- a/src/Discord.Net.Core/RequestOptions.cs +++ b/src/Discord.Net.Core/RequestOptions.cs @@ -15,6 +15,11 @@ namespace Discord public RetryMode? RetryMode { get; set; } public bool HeaderOnly { get; internal set; } /// + /// Should this request bypass the ratelimit buckets? This option should be used sparingly, and when used, should be coupled with your own + /// delays between requests, to avoid encountering 429 errors. + /// + public bool BypassBuckets { get; set; } + /// /// The reason for this action in the guild's audit log /// public string AuditLogReason { get; set; } diff --git a/src/Discord.Net.Rest/Net/Queue/RequestQueueBucket.cs b/src/Discord.Net.Rest/Net/Queue/RequestQueueBucket.cs index 2cc4b8a10..3362c679c 100644 --- a/src/Discord.Net.Rest/Net/Queue/RequestQueueBucket.cs +++ b/src/Discord.Net.Rest/Net/Queue/RequestQueueBucket.cs @@ -48,8 +48,11 @@ namespace Discord.Net.Queue LastAttemptAt = DateTimeOffset.UtcNow; while (true) { - await _queue.EnterGlobalAsync(id, request).ConfigureAwait(false); - await EnterAsync(id, request).ConfigureAwait(false); + if (!request.Options.BypassBuckets) + { + await _queue.EnterGlobalAsync(id, request).ConfigureAwait(false); + await EnterAsync(id, request).ConfigureAwait(false); + } #if DEBUG_LIMITS Debug.WriteLine($"[{id}] Sending...");