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.

DiscordConfig.cs 3.7 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using Discord.Net.Rest;
  2. using Discord.Net.WebSockets;
  3. using System.Reflection;
  4. namespace Discord
  5. {
  6. public class DiscordConfig
  7. {
  8. public const int MaxMessageSize = 2000;
  9. public const int MaxMessagesPerBatch = 100;
  10. public const string LibName = "Discord.Net";
  11. public static string LibVersion => typeof(DiscordConfig).GetTypeInfo().Assembly?.GetName().Version.ToString(3) ?? "Unknown";
  12. public const string LibUrl = "https://github.com/RogueException/Discord.Net";
  13. public const string ClientAPIUrl = "https://discordapp.com/api/";
  14. public const string CDNUrl = "https://cdn.discordapp.com/";
  15. public const string InviteUrl = "https://discord.gg/";
  16. /// <summary> Gets or sets name of your application, used in the user agent. </summary>
  17. public string AppName { get; set; } = null;
  18. /// <summary> Gets or sets url to your application, used in the user agent. </summary>
  19. public string AppUrl { get; set; } = null;
  20. /// <summary> Gets or sets the version of your application, used in the user agent. </summary>
  21. public string AppVersion { get; set; } = null;
  22. /// <summary> Gets or sets the minimum log level severity that will be sent to the LogMessage event. </summary>
  23. public LogSeverity LogLevel { get; set; } = LogSeverity.Info;
  24. /// <summary> Gets or sets the time (in milliseconds) to wait for the websocket to connect and initialize. </summary>
  25. public int ConnectionTimeout { get; set; } = 30000;
  26. /// <summary> Gets or sets the time (in milliseconds) to wait after an unexpected disconnect before reconnecting. </summary>
  27. public int ReconnectDelay { get; set; } = 1000;
  28. /// <summary> Gets or sets the time (in milliseconds) to wait after an reconnect fails before retrying. </summary>
  29. public int FailedReconnectDelay { get; set; } = 15000;
  30. //Performance
  31. /// <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>
  32. public int MessageCacheSize { get; set; } = 100;
  33. /// <summary>
  34. /// Gets or sets whether the permissions cache should be used.
  35. /// This makes operations such as User.GetPermissions(Channel), User.ServerPermissions, Channel.GetUser, and Channel.Members much faster while increasing memory usage.
  36. /// </summary>
  37. public bool UsePermissionsCache { get; set; } = true;
  38. /// <summary> Gets or sets whether the a copy of a model is generated on an update event to allow you to check which properties changed. </summary>
  39. public bool EnablePreUpdateEvents { get; set; } = true;
  40. /// <summary>
  41. /// Gets or sets the max number of users a server may have for offline users to be included in the READY packet. Max is 250.
  42. /// Decreasing this may reduce CPU usage while increasing login time and network usage.
  43. /// </summary>
  44. public int LargeThreshold { get; set; } = 250;
  45. //Engines
  46. /// <summary> Gets or sets the REST engine to use.. Defaults to DefaultRestClientProvider, which uses .Net's HttpClient class. </summary>
  47. public IRestClientProvider RestClientProvider { get; set; } = null;
  48. /// <summary>
  49. /// Gets or sets the WebSocket engine to use. Defaults to DefaultWebSocketProvider, which uses .Net's WebSocketClient class.
  50. /// WebSockets are only used if DiscordClient.Connect() is called.
  51. /// </summary>
  52. public IWebSocketProvider WebSocketProvider { get; set; } = null;
  53. }
  54. }