mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 22:20:52 +00:00
Misc
This commit is contained in:
@@ -221,7 +221,7 @@ namespace ArchiSteamFarm {
|
||||
continue;
|
||||
}
|
||||
|
||||
new Bot(botName).Forget();
|
||||
Bot.RegisterBot(botName);
|
||||
}
|
||||
|
||||
if (Bot.Bots.Count == 0) {
|
||||
@@ -263,7 +263,7 @@ namespace ArchiSteamFarm {
|
||||
return;
|
||||
}
|
||||
|
||||
new Bot(botName).Forget();
|
||||
Bot.RegisterBot(botName);
|
||||
}
|
||||
|
||||
private static async void OnChanged(object sender, FileSystemEventArgs e) {
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace ArchiSteamFarm {
|
||||
private string TwoFactorCode;
|
||||
private byte TwoFactorCodeFailures;
|
||||
|
||||
internal Bot(string botName) {
|
||||
private Bot(string botName) {
|
||||
if (string.IsNullOrEmpty(botName)) {
|
||||
throw new ArgumentNullException(nameof(botName));
|
||||
}
|
||||
@@ -225,8 +225,6 @@ namespace ArchiSteamFarm {
|
||||
TimeSpan.FromMinutes(1) + TimeSpan.FromMinutes(0.2 * Bots.Count), // Delay
|
||||
TimeSpan.FromMinutes(1) // Period
|
||||
);
|
||||
|
||||
InitStart().Forget();
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
@@ -583,6 +581,24 @@ namespace ArchiSteamFarm {
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static void RegisterBot(string botName) {
|
||||
if (string.IsNullOrEmpty(botName)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botName));
|
||||
return;
|
||||
}
|
||||
|
||||
Bot bot;
|
||||
|
||||
try {
|
||||
bot = new Bot(botName);
|
||||
} catch (ArgumentException e) {
|
||||
ASF.ArchiLogger.LogGenericException(e);
|
||||
return;
|
||||
}
|
||||
|
||||
bot.InitStart().Forget();
|
||||
}
|
||||
|
||||
internal void RequestPersonaStateUpdate() {
|
||||
if (!IsConnectedAndLoggedOn) {
|
||||
return;
|
||||
@@ -1119,7 +1135,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
ArchiLogger.LogGenericError(Strings.BotHeartBeatFailed);
|
||||
Destroy(true);
|
||||
new Bot(BotName).Forget();
|
||||
RegisterBot(BotName);
|
||||
}
|
||||
|
||||
private async Task InitStart() {
|
||||
|
||||
Reference in New Issue
Block a user