Browse Source

Made large_threshold mandatory

tags/docs-0.9
RogueException 9 years ago
parent
commit
45ee58a4d5
4 changed files with 5 additions and 13 deletions
  1. +1
    -1
      src/Discord.Net/API/Client/GatewaySocket/Commands/Identify.cs
  2. +1
    -6
      src/Discord.Net/DiscordClient.cs
  3. +2
    -5
      src/Discord.Net/DiscordConfig.cs
  4. +1
    -1
      src/Discord.Net/Net/WebSockets/GatewaySocket.cs

+ 1
- 1
src/Discord.Net/API/Client/GatewaySocket/Commands/Identify.cs View File

@@ -17,7 +17,7 @@ namespace Discord.API.Client.GatewaySocket
[JsonProperty("properties")]
public Dictionary<string, string> Properties { get; set; }
[JsonProperty("large_threshold", NullValueHandling = NullValueHandling.Ignore)]
public int? LargeThreshold { get; set; }
public int LargeThreshold { get; set; }
[JsonProperty("compress")]
public bool UseCompression { get; set; }
}


+ 1
- 6
src/Discord.Net/DiscordClient.cs View File

@@ -896,12 +896,7 @@ namespace Discord
break;
}
else
{
if (Config.UseLargeThreshold)
user = server.AddUser(data.User.Id);
else
user = server.GetUser(data.User.Id);
}
user = server.AddUser(data.User.Id);
}

if (user != null)


+ 2
- 5
src/Discord.Net/DiscordConfig.cs View File

@@ -34,8 +34,6 @@ namespace Discord

/// <summary> Gets or sets whether an encrypted login token should be saved to temp dir after successful login. </summary>
public bool CacheToken { get; set; } = true;
/// <summary> Gets or sets whether Discord should send information about offline users, for servers with more than 100 users. </summary>
public bool UseLargeThreshold { get; set; } = false;
/// <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>
public int MessageCacheSize { get; set; } = 100;
/// <summary> Gets or sets whether the permissions cache should be used. This makes operations such as User.GetPermissions(Channel), User.ServerPermissions and Channel.Members </summary>
@@ -74,7 +72,7 @@ namespace Discord
public int ReconnectDelay { get; }
public int FailedReconnectDelay { get; }

public bool UseLargeThreshold { get; }
public int LargeThreshold { get; } = 250;
public int MessageCacheSize { get; }
public bool UsePermissionsCache { get; }
public bool EnablePreUpdateEvents { get; }
@@ -90,8 +88,7 @@ namespace Discord
ConnectionTimeout = builder.ConnectionTimeout;
ReconnectDelay = builder.ReconnectDelay;
FailedReconnectDelay = builder.FailedReconnectDelay;

UseLargeThreshold = builder.UseLargeThreshold;
MessageCacheSize = builder.MessageCacheSize;
UsePermissionsCache = builder.UsePermissionsCache;
EnablePreUpdateEvents = builder.EnablePreUpdateEvents;


+ 1
- 1
src/Discord.Net/Net/WebSockets/GatewaySocket.cs View File

@@ -161,7 +161,7 @@ namespace Discord.Net.WebSockets
Version = 3,
Token = token,
Properties = props,
LargeThreshold = _config.UseLargeThreshold ? 100 : (int?)null,
LargeThreshold = _config.LargeThreshold,
UseCompression = true
};
QueueMessage(msg);


Loading…
Cancel
Save