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.

DiscordSocketConfig.cs 2.4 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Discord.Net.Udp;
  2. using Discord.Net.WebSockets;
  3. using Discord.Rest;
  4. namespace Discord.WebSocket
  5. {
  6. public class DiscordSocketConfig : DiscordRestConfig
  7. {
  8. public const string GatewayEncoding = "json";
  9. /// <summary> Gets or sets the websocket host to connect to. If null, the client will use the /gateway endpoint. </summary>
  10. public string GatewayHost { get; set; } = null;
  11. /// <summary> Gets or sets the time, in milliseconds, to wait for a connection to complete before aborting. </summary>
  12. public int ConnectionTimeout { get; set; } = 30000;
  13. /// <summary> Gets or sets the id for this shard. Must be less than TotalShards. </summary>
  14. public int? ShardId { get; set; } = null;
  15. /// <summary> Gets or sets the total number of shards for this application. </summary>
  16. public int? TotalShards { get; set; } = null;
  17. /// <summary> Gets or sets the number of messages per channel that should be kept in cache. Setting this to zero disables the message cache entirely. </summary>
  18. public int MessageCacheSize { get; set; } = 0;
  19. /// <summary>
  20. /// Gets or sets the max number of users a guild may have for offline users to be included in the READY packet. Max is 250.
  21. /// </summary>
  22. public int LargeThreshold { get; set; } = 250;
  23. /// <summary> Gets or sets the provider used to generate new websocket connections. </summary>
  24. public WebSocketProvider WebSocketProvider { get; set; }
  25. /// <summary> Gets or sets the provider used to generate new udp sockets. </summary>
  26. public UdpSocketProvider UdpSocketProvider { get; set; }
  27. /// <summary> Gets or sets whether or not all users should be downloaded as guilds come available. </summary>
  28. public bool AlwaysDownloadUsers { get; set; } = false;
  29. /// <summary> Gets or sets the timeout for event handlers, in milliseconds, after which a warning will be logged. Null disables this check. </summary>
  30. public int? HandlerTimeout { get; set; } = 3000;
  31. public DiscordSocketConfig()
  32. {
  33. WebSocketProvider = DefaultWebSocketProvider.Instance;
  34. UdpSocketProvider = DefaultUdpSocketProvider.Instance;
  35. }
  36. internal DiscordSocketConfig Clone() => MemberwiseClone() as DiscordSocketConfig;
  37. }
  38. }