diff --git a/src/client.ts b/src/client.ts index 3a1f767..b17bab3 100644 --- a/src/client.ts +++ b/src/client.ts @@ -143,18 +143,12 @@ export default abstract class CollabVMClient { return; } - //if(message[0] === "chat") { - - // console.log(`FUCK (${message.length}) ${message[1]} ${message[2]}`) - //} - if ( message[0] === "chat" && message.length === 3 && !IsSystemChatInstruction(message) ) { if (message[1] != this._username) { - //console.log(`FUCK 2 (${message.length}) ${message[1]} ${message[2]}`) this.OnChat(message[1], message[2]); return; } @@ -181,21 +175,16 @@ export default abstract class CollabVMClient { } OnAddUser(users: string[], count: number) { - //console.log(users); for (var i = 0; i < count * 2; i += 2) { let name = users[i]; let rank = parseInt(users[i + 1]); - //console.log(`[${this.GetVM()}] user ${name} rank ${rank}`) - let existingUser = this._users.find((elem) => elem.GetName() == name); if (existingUser === undefined) { - //console.log(`[${this.GetVM()}] New user ${name} rank ${rank}`) this._users.push(new UserData(name, rank)); } else { // Handle admin/mod rank update if (existingUser.GetRank() != rank) { - //console.log(`[${this.GetVM()}] updating ${name} to rank ${rank}`) existingUser.UpdateRank(rank); } } @@ -231,7 +220,6 @@ export default abstract class CollabVMClient { var name = this._users[i].GetName(); if (KnownBots.find((elem) => name == elem) !== undefined) { - //console.log("found blacklisted username", name) len--; } } diff --git a/src/index.ts b/src/index.ts index eb00f9a..a7b2b6f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,6 @@ import Config from "./config.js"; let config: Config = JSON.parse(readFileSync("config.json", "utf-8")); function Log(...args: string[]) { - // console.log(`[AnyOSBot] [${new Date()}]`, [...arguments].join(' ')) console.log("[AnyOSBot]", args.join(" ")); } @@ -53,15 +52,12 @@ class RateLimit { // Clean out fractional milliseconds if (ret % 1000 != 0) ret -= ret % 1000; - //Log(`Debug: Ratelimit returns ${ret} (where N = ${this._n})`); return ret; } SetUserCount(count: number) { if (count == 0) count = 1; this._n = count; - - //Log(`Debug: Ratelimit \"${this._ident}\" count set to ${count}, algo says time will be: ${this.GetMs()} (${this.GetMs() / 1000} seconds)`); } StartLimit() { @@ -127,23 +123,8 @@ class HelperBot extends CollabVMClient { } OnClose() { - //console.log(arguments) - // reconnect lol - - /* the right way doesnt work thanks to something - Log(`[${this._vmId}]`, `Connection closed, reconnecting in 5 seconds`); - - let this = this; - setTimeout(() => { - Log(`[${this._vmId}]`, `Reconnecting now`); - this.DoConn(); - }, 1000 * 5) - */ - Log(`[${this._vmId}]`, `Connection closed, exiting process`); process.exit(0); - - // The bot should probably give up after some attempts } Chat(message: string) { @@ -214,8 +195,6 @@ class HelperBot extends CollabVMClient { } OnChat(username: string, message: string) { - //console.log(`${username}> ${message}`); - if (username == this.GetUsername()) return; if (message[0] === config.BOT_PREFIX) { @@ -242,21 +221,13 @@ class HelperBot extends CollabVMClient { // Little code fragment to make rate limiting // more portable. const DoLimit = (limit: RateLimit) => { - //console.log(`[AnyOSBot] [${this._vmId}] ${this.GetUserCount()} users online (${this.GetUserCountFull()} actual)`) - - //if(this._vmId !== 'vm0b0t') { - // if (limit.IsLimited() && !this.UserCanBypass(username)) { this.Chat( `You may not use commands yet. Please wait ${limit.ToString()}.`, ); return false; } - //} - //console.log(`[AnyOSBot] [${this._vmId}] ${new Date()} ${username} executed command ${command}`) - - //Log(`[${this._vmId}]`, `${username} executed \"!${command}\"`); Log(`[${this._vmId}]`, `${username} executed \"${message}\"`); if (!this.UserCanBypass(username)) { @@ -385,11 +356,6 @@ class HelperBot extends CollabVMClient { case "certerror": if (!DoLimit(this.GeneralCmdLimit!)) return; - //if(this._vmId == 'vm0b0t') { - // this.SendGuacamoleMessage("admin", "21", "