Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
3urobeat committed Aug 12, 2023
1 parent 7601a5d commit 038a0b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions src/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: 17.10.2022 17:32:28
* Author: 3urobeat
*
* Last Modified: 30.06.2023 09:43:18
* Last Modified: 12.08.2023 11:54:12
* Modified By: 3urobeat
*
* Copyright (c) 2022 3urobeat <https://github.com/3urobeat>
Expand All @@ -29,7 +29,7 @@ const config = require("../config.json");
* @param {Object} logOnOptions The logOnOptions obj for this account
* @param {Number} loginindex The loginindex for this account
*/
const bot = function(logOnOptions, loginindex, proxies) {
const Bot = function(logOnOptions, loginindex, proxies) {

this.logOnOptions = logOnOptions;
this.loginindex = loginindex;
Expand All @@ -45,11 +45,11 @@ const bot = function(logOnOptions, loginindex, proxies) {

};

module.exports = bot;
module.exports = Bot;


// Handles logging in this account
bot.prototype.login = async function() {
Bot.prototype.login = async function() {

/* ------------ Login ------------ */
if (this.proxy) logger("info", `Logging in ${this.logOnOptions.accountName} in ${config.loginDelay / 1000} seconds with proxy '${this.proxy}'...`);
Expand All @@ -71,7 +71,7 @@ bot.prototype.login = async function() {
};


bot.prototype.attachEventListeners = function() {
Bot.prototype.attachEventListeners = function() {

this.client.on("loggedOn", () => { // This account is now logged on
controller.nextacc++; // The next account can start
Expand Down Expand Up @@ -139,8 +139,8 @@ bot.prototype.attachEventListeners = function() {
});


this.client.on("friendMessage", (steamID, message) => {
var steamID64 = new SteamID(String(steamID)).getSteamID64();
this.client.chat.on("friendMessage", (steamID, message) => {
let steamID64 = new SteamID(String(steamID)).getSteamID64();

logger("info", `[${this.logOnOptions.accountName}] Friend message from ${steamID64}: ${message}`);

Expand Down Expand Up @@ -184,14 +184,14 @@ bot.prototype.attachEventListeners = function() {


// Handles relogging this bot account
bot.prototype.handleRelog = function() {
Bot.prototype.handleRelog = function() {
if (controller.relogQueue.includes(this.loginindex)) return; // Don't handle this request if account is already waiting for relog

controller.relogQueue.push(this.loginindex); // Add account to queue

// Check if it's our turn to relog every 1 sec after waiting relogDelay ms
setTimeout(() => {
var relogInterval = setInterval(() => {
let relogInterval = setInterval(() => {
if (controller.relogQueue.indexOf(this.loginindex) != 0) return; // Not our turn? stop and retry in the next iteration

clearInterval(relogInterval); // Prevent any retries
Expand Down
6 changes: 3 additions & 3 deletions src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: 17.10.2022 18:00:31
* Author: 3urobeat
*
* Last Modified: 30.06.2023 09:43:18
* Last Modified: 12.08.2023 11:55:40
* Modified By: 3urobeat
*
* Copyright (c) 2022 3urobeat <https://github.com/3urobeat>
Expand Down Expand Up @@ -127,7 +127,7 @@ module.exports.start = async () => {
Object.values(logininfo).forEach((e, i) => {
setTimeout(() => {

var readycheckinterval = setInterval(() => {
let readycheckinterval = setInterval(() => {
if (this.nextacc == i) { // Check if it is our turn
clearInterval(readycheckinterval);

Expand All @@ -138,7 +138,7 @@ module.exports.start = async () => {
bot.login();
}
}, 250);

}, 1000);
});

};

0 comments on commit 038a0b6

Please sign in to comment.