Skip to content

Commit

Permalink
chore: Reduce or improve log msg amount on startup in general
Browse files Browse the repository at this point in the history
  • Loading branch information
3urobeat committed Mar 8, 2024
1 parent 690480a commit cf2bc44
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/bot/events/loggedOn.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: 2021-07-09 16:26:00
* Author: 3urobeat
*
* Last Modified: 2024-03-08 17:49:10
* Last Modified: 2024-03-08 18:23:17
* Modified By: 3urobeat
*
* Copyright (c) 2021 - 2024 3urobeat <https://github.com/3urobeat>
Expand All @@ -28,7 +28,7 @@ Bot.prototype._attachSteamLoggedOnEvent = function() {
this.user.on("loggedOn", () => {

// Print message and set status to online
logger("debug", `[${this.logPrefix}] Account logged in! Public IP of this account: ${this.user.publicIP}`, false, true);
logger("debug", `[${this.logPrefix}] Account logged in! Public IP of this account: ${this.user.publicIP}`);

if (this.index == 0) {
logger("debug", `[${this.logPrefix}] Setting online status '${this.data.advancedconfig.onlineStatus}' as enum '${EPersonaState[this.data.advancedconfig.onlineStatus]}'`);
Expand Down
4 changes: 2 additions & 2 deletions src/commands/commandHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: 2023-04-01 21:54:21
* Author: 3urobeat
*
* Last Modified: 2024-02-29 20:17:33
* Last Modified: 2024-03-08 18:18:46
* Modified By: 3urobeat
*
* Copyright (c) 2023 - 2024 3urobeat <https://github.com/3urobeat>
Expand Down Expand Up @@ -67,7 +67,7 @@ const CommandHandler = function(controller) {
CommandHandler.prototype._importCoreCommands = function() {
return new Promise((resolve) => {

logger("info", "CommandHandler: Loading all core commands...", false, true, logger.animation("loading"));
logger("debug", "CommandHandler: Loading all core commands...");

fs.readdir("./src/commands/core", (err, files) => {

Expand Down
4 changes: 2 additions & 2 deletions src/commands/core/friend.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: 2021-07-09 16:26:00
* Author: 3urobeat
*
* Last Modified: 2024-02-28 22:37:55
* Last Modified: 2024-03-08 18:24:40
* Modified By: 3urobeat
*
* Copyright (c) 2021 - 2024 3urobeat <https://github.com/3urobeat>
Expand Down Expand Up @@ -212,7 +212,7 @@ module.exports.unfriendall = {
logger("info", `Removing friend ${friendSteamID.getSteamID64()} from all bot accounts...`, false, false, logger.animation("loading"));
commandHandler.controller.getBots()[i].user.removeFriend(friendSteamID);
} else {
logger("debug", `unfriendAll(): Friend ${friendSteamID.getSteamID64()} seems to be an owner, skipping...`, false, false, logger.animation("loading"));
logger("debug", `unfriendAll(): Friend ${friendSteamID.getSteamID64()} seems to be an owner, skipping...`);
}
}, 1000 * i); // Delay every iteration so that we don't make a ton of requests at once
} catch (err) {
Expand Down
4 changes: 2 additions & 2 deletions src/controller/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: 2021-07-09 16:26:00
* Author: 3urobeat
*
* Last Modified: 2024-03-07 18:03:14
* Last Modified: 2024-03-08 18:20:05
* Modified By: 3urobeat
*
* Copyright (c) 2021 - 2024 3urobeat <https://github.com/3urobeat>
Expand Down Expand Up @@ -142,7 +142,7 @@ Controller.prototype.login = async function(firstLogin) {

clearInterval(allAccsOnlineInterval);

logger("info", "Finished logging in all currently queued accounts! Calling myself again to check for any new accounts...", false, false, logger.animation("loading"));
logger("info", "Finished logging in all currently queued accounts! Checking for any new accounts...", false, false, logger.animation("loading"));

this.info.activeLogin = false;

Expand Down
16 changes: 8 additions & 8 deletions src/data/fileStructure.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "94405ecfae8f113b0e38169b09c1f2dd"
"checksum": "bfa57e1198eed440735f4a7fc300bd95"
},
{
"path": "src/bot/events/relationship.js",
Expand Down Expand Up @@ -383,7 +383,7 @@
{
"path": "src/commands/commandHandler.js",
"url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/commands/commandHandler.js",
"checksum": "e4523ce0506976d22a55c938aad4eba9"
"checksum": "a39e912f50969e3b13cbc45d0823d14e"
},
{
"path": "src/commands/core/block.js",
Expand All @@ -408,7 +408,7 @@
{
"path": "src/commands/core/friend.js",
"url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/commands/core/friend.js",
"checksum": "1c3bcf6b9bbd2a1465f9f54b03d17928"
"checksum": "26800bddf4e1c79331dca96c43e38fea"
},
{
"path": "src/commands/core/general.js",
Expand Down Expand Up @@ -548,7 +548,7 @@
{
"path": "src/controller/login.js",
"url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/controller/login.js",
"checksum": "9ca82532f19176e0af017d596697e776"
"checksum": "a3181994388cb9145687ff167345ee47"
},
{
"path": "src/data/ascii.js",
Expand Down Expand Up @@ -588,7 +588,7 @@
{
"path": "src/dataManager/dataImport.js",
"url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/dataManager/dataImport.js",
"checksum": "e35c794d60fd0f15534a63081afe7407"
"checksum": "16091447de2f8daa460e9bba67d38e4a"
},
{
"path": "src/dataManager/dataIntegrity.js",
Expand Down Expand Up @@ -638,7 +638,7 @@
{
"path": "src/dataManager/helpers/refreshCache.js",
"url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/dataManager/helpers/refreshCache.js",
"checksum": "acb6ae61becdfe4613d2387f4660f8f5"
"checksum": "45511a56fb61cd18f36f89e215881722"
},
{
"path": "src/dataManager/helpers/repairFile.js",
Expand All @@ -648,7 +648,7 @@
{
"path": "src/jobs/jobManager.js",
"url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/jobs/jobManager.js",
"checksum": "9f911f54fefc0f4e4db87b6d190992d3"
"checksum": "37dec9dd3507e1c98903722391115944"
},
{
"path": "src/libraryPatches/CSteamDiscussion.js",
Expand Down Expand Up @@ -703,7 +703,7 @@
{
"path": "src/pluginSystem/loadPlugins.js",
"url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/pluginSystem/loadPlugins.js",
"checksum": "e411202cda325c73ce8983f4bc421e20"
"checksum": "236e11079a89df528f4e609eb68e784e"
},
{
"path": "src/pluginSystem/pluginSystem.js",
Expand Down
15 changes: 8 additions & 7 deletions src/dataManager/dataImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: 2021-07-09 16:26:00
* Author: 3urobeat
*
* Last Modified: 2024-02-24 12:26:07
* Last Modified: 2024-03-08 18:26:36
* Modified By: 3urobeat
*
* Copyright (c) 2021 - 2024 3urobeat <https://github.com/3urobeat>
Expand Down Expand Up @@ -161,7 +161,7 @@ DataManager.prototype._importFromDisk = async function () {
});
});

logger("info", `Found ${logininfo.length} accounts in accounts.txt, not checking for logininfo.json...`, false, true, logger.animation("loading"));
logger("debug", `DataManager _importFromDisk(): Found ${logininfo.length} accounts in accounts.txt, not checking for logininfo.json...`);

return resolve(logininfo);
}
Expand Down Expand Up @@ -191,7 +191,7 @@ DataManager.prototype._importFromDisk = async function () {
});
}

logger("info", `Found ${logininfo.length} accounts in logininfo.json...`, false, true, logger.animation("loading"));
logger("debug", `Found ${logininfo.length} accounts in logininfo.json...`);

resolve(logininfo);
} catch (err) {
Expand Down Expand Up @@ -268,8 +268,6 @@ DataManager.prototype._importFromDisk = async function () {
// Check if quotes.txt is empty to avoid errors further down when trying to comment
logger("error", `${logger.colors.fgred}You haven't put any comment quotes into the quotes.txt file! Aborting...`, true);
return _this.controller.stop();
} else {
logger("info", `Successfully loaded ${quotes.length} quotes from quotes.txt...`, false, true, logger.animation("loading"));
}

resolve(quotes);
Expand All @@ -290,6 +288,8 @@ DataManager.prototype._importFromDisk = async function () {

// Iterate through all files in lang dir and load them
fs.readdir("./src/data/lang", (err, files) => {
logger("debug", `DataManager _importFromDisk(): Found these languages in the lang folder: '${files.toString()}'`);

files.forEach((e) => {
let thisFile;

Expand All @@ -307,7 +307,6 @@ DataManager.prototype._importFromDisk = async function () {

// Resolve with success message or force restore default language
if (Object.keys(obj).length > 0 && obj["english"]) {
logger("info", `Successfully loaded ${Object.keys(obj).length} languages!`, false, true, logger.animation("loading"));
resolve(obj);
} else {
_this._pullNewFile("english.json", "./src/data/lang/english.json", (e) => resolve({ "english": e })); // Only resolve for the default language
Expand Down Expand Up @@ -375,7 +374,7 @@ DataManager.prototype._importFromDisk = async function () {
if (langIteration == Object.keys(customlang).length - 1) resolve(_this.lang);
});
} else {
logger("info", "No customlang.json file found...", false, true, logger.animation("loading"));
logger("debug", "DataManager _importFromDisk(): No customlang.json file found");
resolve(_this.lang); // Resolve with default lang object
}
});
Expand All @@ -400,4 +399,6 @@ DataManager.prototype._importFromDisk = async function () {
this.tokensDB = new nedb({ filename: srcdir + "/data/tokens.db", autoload: true });
this.userSettingsDB = new nedb({ filename: srcdir + "/data/userSettings.db", autoload: true });

logger("info", `Successfully loaded ${this.logininfo.length} accounts, ${this.proxies.length} proxies, ${this.quotes.length} quotes, ${Object.keys(this.lang).length} languages and 4 databases!`, false, true, logger.animation("loading"));

};
6 changes: 3 additions & 3 deletions src/dataManager/helpers/refreshCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Created Date: 2023-03-29 17:44:47
* Author: 3urobeat
*
* Last Modified: 2023-12-27 14:13:26
* Last Modified: 2024-03-08 18:27:14
* Modified By: 3urobeat
*
* Copyright (c) 2023 3urobeat <https://github.com/3urobeat>
* Copyright (c) 2023 - 2024 3urobeat <https://github.com/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.
Expand Down Expand Up @@ -46,7 +46,7 @@ DataManager.prototype.refreshCache = function () {
});

// Update Backups
logger("debug", "Writing backups to cache.json...", false, true, logger.animation("loading"));
logger("debug", "Writing backups to cache.json...");
this.cachefile["configjson"] = this.config;
this.cachefile["advancedconfigjson"] = this.advancedconfig;
this.cachefile["datajson"] = this.datafile;
Expand Down
6 changes: 3 additions & 3 deletions src/jobs/jobManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: 2024-02-11 10:48:17
* Author: 3urobeat
*
* Last Modified: 2024-02-11 16:57:53
* Last Modified: 2024-03-08 18:17:43
* Modified By: 3urobeat
*
* Copyright (c) 2024 3urobeat <https://github.com/3urobeat>
Expand Down Expand Up @@ -113,7 +113,7 @@ JobManager.prototype.registerJob = function(job) {
// Register job and return null on success
this.jobs.push(job);

logger("info", `JobManager: Registered job '${job.name}' which executes ${job.runOnRegistration ? "now and then " : ""}every ${job.interval}ms`, false, true);
logger("debug", `JobManager: Registered job '${job.name}' which executes ${job.runOnRegistration ? "now and then " : ""}every ${job.interval}ms`);

return null;

Expand All @@ -137,7 +137,7 @@ JobManager.prototype.unregisterJob = function(name) {

this.jobs.splice(index, 1);

logger("info", `JobManager: Unregistered job '${name}'!`);
logger("debug", `JobManager: Unregistered job '${name}'!`);

return null;

Expand Down
4 changes: 2 additions & 2 deletions src/pluginSystem/loadPlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: 2023-06-04 15:37:17
* Author: DerDeathraven
*
* Last Modified: 2024-03-02 11:24:28
* Last Modified: 2024-03-08 18:19:31
* Modified By: 3urobeat
*
* Copyright (c) 2023 - 2024 3urobeat <https://github.com/3urobeat>
Expand Down Expand Up @@ -121,7 +121,7 @@ PluginSystem.prototype._loadPlugins = async function () {
continue;
}

logger("info", `PluginSystem: Loading plugin '${pluginName}' v${pluginJson.version} by ${pluginJson.author} made for v${pluginJson.botVersion}...`, false, true, logger.animation("loading"));
logger("info", `PluginSystem: Loading plugin '${pluginName}' v${pluginJson.version} by '${pluginJson.author}' made for v${pluginJson.botVersion}...`, false, true, logger.animation("loading"));

// Display warning if bot version mismatches plugin's botVersion
try {
Expand Down

0 comments on commit cf2bc44

Please sign in to comment.