mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Add warning about excessive bots count
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
@@ -31,6 +32,9 @@ using ArchiSteamFarm.NLog;
|
||||
|
||||
namespace ArchiSteamFarm {
|
||||
internal static class ASF {
|
||||
// This is based on internal Valve guidelines, we're not using it as a hard limit
|
||||
private const byte MaximumRecommendedBotsCount = 10;
|
||||
|
||||
internal static readonly ArchiLogger ArchiLogger = new ArchiLogger(SharedInfo.ASF);
|
||||
|
||||
private static readonly ConcurrentDictionary<string, object> LastWriteEvents = new ConcurrentDictionary<string, object>();
|
||||
@@ -47,17 +51,28 @@ namespace ArchiSteamFarm {
|
||||
// Before attempting to connect, initialize our configuration
|
||||
await Bot.InitializeSteamConfiguration(Program.GlobalConfig.SteamProtocols, Program.GlobalDatabase.CellID, Program.GlobalDatabase.ServerListProvider).ConfigureAwait(false);
|
||||
|
||||
HashSet<string> botNames;
|
||||
|
||||
try {
|
||||
await Utilities.InParallel(Directory.EnumerateFiles(SharedInfo.ConfigDirectory, "*" + SharedInfo.ConfigExtension).Select(Path.GetFileNameWithoutExtension).Where(botName => !string.IsNullOrEmpty(botName) && IsValidBotName(botName)).OrderBy(botName => botName).Select(Bot.RegisterBot)).ConfigureAwait(false);
|
||||
botNames = Directory.EnumerateFiles(SharedInfo.ConfigDirectory, "*" + SharedInfo.ConfigExtension).Select(Path.GetFileNameWithoutExtension).Where(botName => !string.IsNullOrEmpty(botName) && IsValidBotName(botName)).ToHashSet();
|
||||
} catch (Exception e) {
|
||||
ArchiLogger.LogGenericException(e);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (Bot.Bots.Count == 0) {
|
||||
if (botNames.Count == 0) {
|
||||
ArchiLogger.LogGenericWarning(Strings.ErrorNoBotsDefined);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (botNames.Count > MaximumRecommendedBotsCount) {
|
||||
ArchiLogger.LogGenericWarning(string.Format(Strings.WarningExcessiveBotsCount, MaximumRecommendedBotsCount));
|
||||
await Task.Delay(10000).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
await Utilities.InParallel(botNames.OrderBy(botName => botName).Select(Bot.RegisterBot)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
internal static void InitEvents() {
|
||||
|
||||
9
ArchiSteamFarm/Localization/Strings.Designer.cs
generated
9
ArchiSteamFarm/Localization/Strings.Designer.cs
generated
@@ -1422,6 +1422,15 @@ namespace ArchiSteamFarm.Localization {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wyszukuje zlokalizowany ciąg podobny do ciągu You're running more personal bot accounts than our upper recommended limit ({0}). Be advised that this setup is not supported and might cause various Steam-related issues, including account suspensions. Check out the FAQ for more details..
|
||||
/// </summary>
|
||||
internal static string WarningExcessiveBotsCount {
|
||||
get {
|
||||
return ResourceManager.GetString("WarningExcessiveBotsCount", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wyszukuje zlokalizowany ciąg podobny do ciągu Failed!.
|
||||
/// </summary>
|
||||
|
||||
@@ -675,4 +675,7 @@ StackTrace:
|
||||
<value>Matched a total of {0} sets this round.</value>
|
||||
<comment>{0} will be replaced by number of sets traded</comment>
|
||||
</data>
|
||||
<data name="WarningExcessiveBotsCount" xml:space="preserve">
|
||||
<value>You're running more personal bot accounts than our upper recommended limit ({0}). Be advised that this setup is not supported and might cause various Steam-related issues, including account suspensions. Check out the FAQ for more details.</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user