diff --git a/src/bot/events/disconnected.js b/src/bot/events/disconnected.js index bcaf135b..cfa2e3c6 100644 --- a/src/bot/events/disconnected.js +++ b/src/bot/events/disconnected.js @@ -4,10 +4,10 @@ * Created Date: 2021-07-09 16:26:00 * Author: 3urobeat * - * Last Modified: 2023-12-27 13:58:37 + * Last Modified: 2024-03-08 17:40:03 * Modified By: 3urobeat * - * Copyright (c) 2021 - 2023 3urobeat + * Copyright (c) 2021 - 2024 3urobeat * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -28,8 +28,6 @@ Bot.prototype._attachSteamDisconnectedEvent = function() { if (this.status == Bot.EStatus.OFFLINE && this.controller.info.activeLogin) return; // Ignore if account is already marked as offline and a login process is active - logger("info", `${logger.colors.fgred}[${this.logPrefix}] Lost connection to Steam. Message: ${msg} | Check: https://steamstat.us`); - // Store disconnect timestamp & reason this.lastDisconnect.timestamp = Date.now(); this.lastDisconnect.reason = msg; @@ -38,11 +36,11 @@ Bot.prototype._attachSteamDisconnectedEvent = function() { // Don't relog if account is in skippedaccounts array or if relogAfterDisconnect is false if (!this.controller.info.skippedaccounts.includes(this.loginData.logOnOptions.accountName) && this.controller.info.relogAfterDisconnect) { - logger("info", `${logger.colors.fggreen}[${this.logPrefix}] Initiating a login retry in ${this.controller.data.advancedconfig.loginRetryTimeout / 1000} seconds.`); // Announce relog + logger("info", `${logger.colors.fgred}[${this.logPrefix}] Lost connection to Steam: '${msg}'. Initiating a login retry in ${this.controller.data.advancedconfig.loginRetryTimeout / 1000} seconds.`); // Announce relog setTimeout(() => this.controller.login(), this.controller.data.advancedconfig.loginRetryTimeout); // Relog in loginRetryTimeout ms } else { - logger("info", `[${this.logPrefix}] I won't queue myself for a relog because this account is either already being relogged, was skipped or this is an intended logOff.`); + logger("info", `${logger.colors.fgred}[${this.logPrefix}] Lost connection to Steam: '${msg}'. I won't queue for a relog because this account is either already being relogged, was skipped or this is an intended logOff.`); } }); diff --git a/src/bot/events/error.js b/src/bot/events/error.js index 3bdb5bd6..45ce77fa 100644 --- a/src/bot/events/error.js +++ b/src/bot/events/error.js @@ -4,7 +4,7 @@ * Created Date: 2021-07-09 16:26:00 * Author: 3urobeat * - * Last Modified: 2024-03-08 13:00:16 + * Last Modified: 2024-03-08 17:44:50 * Modified By: 3urobeat * * Copyright (c) 2021 - 2024 3urobeat @@ -49,7 +49,6 @@ Bot.prototype._attachSteamErrorEvent = function() { // Check if this is a connection loss and not a login error (because disconnects are thrown here when SteamUser's autoRelogin is false) if (this.status == Bot.EStatus.ONLINE) { // It must be a fresh connection loss if status has not changed yet - logger("info", `${logger.colors.fgred}[${this.logPrefix}] Lost connection to Steam. Reason: '${err}'`); this.controller._statusUpdateEvent(this, Bot.EStatus.OFFLINE); // Set status of this account to offline // Store disconnect timestamp & reason @@ -58,11 +57,11 @@ Bot.prototype._attachSteamErrorEvent = function() { // Check if this is an intended logoff if (this.controller.info.relogAfterDisconnect && !this.controller.info.skippedaccounts.includes(this.loginData.logOnOptions.accountName)) { - logger("info", `${logger.colors.fggreen}[${this.logPrefix}] Initiating a login retry in ${this.controller.data.advancedconfig.loginRetryTimeout / 1000} seconds.`); // Announce relog + logger("info", `${logger.colors.fgred}[${this.logPrefix}] Lost connection to Steam: '${err}'. Initiating a login retry in ${this.controller.data.advancedconfig.loginRetryTimeout / 1000} seconds.`); // Announce relog setTimeout(() => this.controller.login(), this.controller.data.advancedconfig.loginRetryTimeout); // Relog after waiting loginRetryTimeout ms } else { - logger("info", `[${this.logPrefix}] I won't queue myself for a relog because this account was skipped or this is an intended logOff.`); + logger("info", `${logger.colors.fgred}[${this.logPrefix}] Lost connection to Steam: '${err}'. I won't queue for a relog because this account was skipped or this is an intended logOff.`); } } else { // Actual error during login @@ -106,7 +105,7 @@ Bot.prototype._attachSteamErrorEvent = function() { } else { - logger("warn", `[${this.logPrefix}] '${err}' while trying to log in. Retrying in 5 seconds..."}`, false, false, null, true); // Log error as warning + logger("warn", `[${this.logPrefix}] '${err}' while trying to log in. Retrying in 5 seconds...`, false, false, null, true); // Log error as warning // Try again in 5 sec, Controller's login function waits for any status that is not offline setTimeout(() => this._loginToSteam(), 5000); diff --git a/src/bot/events/loggedOn.js b/src/bot/events/loggedOn.js index ebcb639a..c6c082c0 100644 --- a/src/bot/events/loggedOn.js +++ b/src/bot/events/loggedOn.js @@ -4,7 +4,7 @@ * Created Date: 2021-07-09 16:26:00 * Author: 3urobeat * - * Last Modified: 2024-02-10 14:08:02 + * Last Modified: 2024-03-08 17:49:10 * Modified By: 3urobeat * * Copyright (c) 2021 - 2024 3urobeat @@ -28,7 +28,7 @@ Bot.prototype._attachSteamLoggedOnEvent = function() { this.user.on("loggedOn", () => { // Print message and set status to online - logger("info", `[${this.logPrefix}] Account logged in! Waiting for websession...`, false, true, logger.animation("loading")); + logger("debug", `[${this.logPrefix}] Account logged in! Public IP of this account: ${this.user.publicIP}`, false, true); if (this.index == 0) { logger("debug", `[${this.logPrefix}] Setting online status '${this.data.advancedconfig.onlineStatus}' as enum '${EPersonaState[this.data.advancedconfig.onlineStatus]}'`); @@ -38,9 +38,6 @@ Bot.prototype._attachSteamLoggedOnEvent = function() { this.user.setPersona(EPersonaState[this.data.advancedconfig.childAccOnlineStatus]); // Set child acc online status } - logger("debug", `[${this.logPrefix}] Public IP of this account: ${this.user.publicIP}`); - - // Increase progress bar if one is active if (logger.getProgressBar()) logger.increaseProgressBar((100 / this.data.logininfo.length) / 3); diff --git a/src/bot/events/webSession.js b/src/bot/events/webSession.js index a1e50864..b4208b8d 100644 --- a/src/bot/events/webSession.js +++ b/src/bot/events/webSession.js @@ -4,7 +4,7 @@ * Created Date: 2021-07-09 16:26:00 * Author: 3urobeat * - * Last Modified: 2024-02-29 14:10:29 + * Last Modified: 2024-03-08 16:21:53 * Modified By: 3urobeat * * Copyright (c) 2021 - 2024 3urobeat @@ -39,9 +39,12 @@ Bot.prototype._attachSteamWebSessionEvent = function() { this.loginData.relogTries = 0; // Reset relogTries to indicate that this proxy is working should one of the next logOn retries fail this.loginData.pendingLogin = false; // Unlock login again - - if (!this.controller.info.readyAfter) logger("info", `[${this.logPrefix}] Got websession and set cookies. Accepting offline friend & group invites...`, false, true, logger.animation("loading")); // Only print message with animation if the bot was not fully started yet - else logger("info", `[${this.logPrefix}] Got websession and set cookies. Accepting offline friend & group invites...`, false, true); + // Print logged in message with animation on initial login, otherwise without + if (!this.controller.info.readyAfter) { + logger("info", `[${this.logPrefix}] Logged in! Accepting pending friend requests & group invites...`, false, true, logger.animation("loading")); + } else { + logger("info", `[${this.logPrefix}] Logged in! Accepting pending friend requests & group invites...`, false, true); + } // Run check if all friends are in lastcomment.db database for main bot account diff --git a/src/controller/events/statusUpdate.js b/src/controller/events/statusUpdate.js index 93625953..9109d8bf 100644 --- a/src/controller/events/statusUpdate.js +++ b/src/controller/events/statusUpdate.js @@ -4,7 +4,7 @@ * Created Date: 2023-03-30 21:05:13 * Author: 3urobeat * - * Last Modified: 2024-02-28 19:57:36 + * Last Modified: 2024-03-08 17:49:26 * Modified By: 3urobeat * * Copyright (c) 2023 - 2024 3urobeat @@ -31,7 +31,7 @@ Controller.prototype._statusUpdateEvent = function(bot, newStatus) { bot.status = newStatus; // Log debug message - logger("info", `[${bot.logPrefix}] Event statusUpdate: Changed status from ${Bot.EStatus[oldStatus]} to ${Bot.EStatus[newStatus]}`, false, true, logger.animation("loading")); + logger("debug", `[${bot.logPrefix}] Event statusUpdate: Changed status from ${Bot.EStatus[oldStatus]} to ${Bot.EStatus[newStatus]}`, false, true); // Emit event this.events.emit("statusUpdate", bot, oldStatus, newStatus); diff --git a/src/data/fileStructure.json b/src/data/fileStructure.json index 72496532..ae359926 100644 --- a/src/data/fileStructure.json +++ b/src/data/fileStructure.json @@ -328,12 +328,12 @@ { "path": "src/bot/events/disconnected.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/bot/events/disconnected.js", - "checksum": "38cf0c4ac7164d5cb902b65d287b902d" + "checksum": "92fda70994fd7f04246c75ca85d6aa3e" }, { "path": "src/bot/events/error.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/bot/events/error.js", - "checksum": "6823b9bcda9d8abe8892f4f3cca0dce9" + "checksum": "8415adcfa88700af656c85657a3c05c3" }, { "path": "src/bot/events/friendMessage.js", @@ -343,7 +343,7 @@ { "path": "src/bot/events/loggedOn.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/bot/events/loggedOn.js", - "checksum": "b0e36936c50b3efc27dc7fb7255b39eb" + "checksum": "94405ecfae8f113b0e38169b09c1f2dd" }, { "path": "src/bot/events/relationship.js", @@ -353,7 +353,7 @@ { "path": "src/bot/events/webSession.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/bot/events/webSession.js", - "checksum": "9a5ae34296fcaa9912f5e7e818841fa9" + "checksum": "23ffa55367ac713ce9ce6c2ec4c3d913" }, { "path": "src/bot/helpers/checkMsgBlock.js", @@ -503,7 +503,7 @@ { "path": "src/controller/events/statusUpdate.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/controller/events/statusUpdate.js", - "checksum": "3d8ee1a34d7d4f9911ade350dd03b7f7" + "checksum": "5a7c66ae19eb320bacf6d2c2abeba9d6" }, { "path": "src/controller/events/steamGuardInput.js", @@ -728,7 +728,7 @@ { "path": "src/sessions/helpers/tokenStorageHandler.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/sessions/helpers/tokenStorageHandler.js", - "checksum": "edd3065f5f2d0a9b5e178d5dfc701ded" + "checksum": "3b7bee517850238ba69d7e369cd0950b" }, { "path": "src/sessions/sessionHandler.js", diff --git a/src/sessions/helpers/tokenStorageHandler.js b/src/sessions/helpers/tokenStorageHandler.js index 7fcdfaea..02fa7401 100644 --- a/src/sessions/helpers/tokenStorageHandler.js +++ b/src/sessions/helpers/tokenStorageHandler.js @@ -4,7 +4,7 @@ * Created Date: 2022-10-10 12:53:20 * Author: 3urobeat * - * Last Modified: 2024-02-27 17:27:32 + * Last Modified: 2024-03-08 17:49:48 * Modified By: 3urobeat * * Copyright (c) 2022 - 2024 3urobeat @@ -61,7 +61,7 @@ SessionHandler.prototype._getTokenFromStorage = function(callback) { // Compare expire value (unix timestamp in seconds) to current date if (jwtObj.exp * 1000 > Date.now()) { - logger("info", `[${this.bot.logPrefix}] Found valid token until '${validUntilStr}' in tokens.db! Logging in with it to reuse session...`, false, true, logger.animation("loading")); + logger("debug", `[${this.bot.logPrefix}] Found valid token until '${validUntilStr}' in tokens.db! Logging in with it to reuse session...`, false, true); callback(doc.token); } else { logger("info", `[${this.bot.logPrefix}] Found invalid token in tokens.db. It was valid till '${validUntilStr}'. Logging in with credentials to get a new session...`, false, true, logger.animation("loading"));