You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

RequestOptions.cs 1.4 kB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Threading;
  2. namespace Discord
  3. {
  4. public class RequestOptions
  5. {
  6. public static RequestOptions Default => new RequestOptions();
  7. /// <summary>
  8. /// The max time, in milliseconds, to wait for this request to complete. If null, a request will not time out.
  9. /// If a rate limit has been triggered for this request's bucket and will not be unpaused in time, this request will fail immediately.
  10. /// </summary>
  11. public int? Timeout { get; set; }
  12. public CancellationToken CancelToken { get; set; } = CancellationToken.None;
  13. public RetryMode? RetryMode { get; set; }
  14. public bool HeaderOnly { get; internal set; }
  15. /// <summary>
  16. /// The reason for this action in the guild's audit log
  17. /// </summary>
  18. public string AuditLogReason { get; set; }
  19. internal bool IgnoreState { get; set; }
  20. internal string BucketId { get; set; }
  21. internal bool IsClientBucket { get; set; }
  22. internal static RequestOptions CreateOrClone(RequestOptions options)
  23. {
  24. if (options == null)
  25. return new RequestOptions();
  26. else
  27. return options.Clone();
  28. }
  29. public RequestOptions()
  30. {
  31. Timeout = DiscordConfig.DefaultRequestTimeout;
  32. }
  33. public RequestOptions Clone() => MemberwiseClone() as RequestOptions;
  34. }
  35. }