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.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 bool IsReactionBucket { get; set; }
  23. internal static RequestOptions CreateOrClone(RequestOptions options)
  24. {
  25. if (options == null)
  26. return new RequestOptions();
  27. else
  28. return options.Clone();
  29. }
  30. public RequestOptions()
  31. {
  32. Timeout = DiscordConfig.DefaultRequestTimeout;
  33. }
  34. public RequestOptions Clone() => MemberwiseClone() as RequestOptions;
  35. }
  36. }