remove old crusty ass comments

This commit is contained in:
Elijah R 2024-06-23 19:52:20 -04:00
parent de85df943f
commit 7632d84510
2 changed files with 0 additions and 95 deletions

View file

@ -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--;
}
}

View file

@ -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", "<h1>fuck off retard why are you trying to get collabnet on vm0</h1>");
// return;
//}
this.SendGuacamoleMessage(
"admin",
"21",
@ -442,8 +408,6 @@ class HelperBot extends CollabVMClient {
this.QemuChangeCd(this.ConcatPath("crustywin", arg), "");
else if (command == "cd")
this.QemuChangeCd(this.ConcatPath("computernewb", arg), "");
//this.QemuChangeCd(this.ConcatPath(command === 'lilycd' && 'lily' || command === "crustycd" && 'crustywin' || 'computernewb', arg), "");
}
break;
@ -478,9 +442,6 @@ class HelperBot extends CollabVMClient {
break;
case "httpcd":
//this.Chat("Disabled due to retards, sorry! Try !cd, !lilycd or !crustycd for some local isos.");
//return;
// whitelisted domains
const whitelist = [
"http://kernel.org",
@ -496,42 +457,16 @@ class HelperBot extends CollabVMClient {
"https://archive.elijahr.dev/Games/pcgc.iso",
];
/*var is_founded = false; // this might not be elegant sorry - Hilda
for (var piss in whitelist) {
//console.log(`${arg.indexOf(whitelist[piss])}`);
if (arg.startsWith(whitelist[piss]) === true) { // no archive.org/cock.iso?ignore=validurl
is_founded = true;
break;
}
}*/
// Yeah I knew it, thanks modeco! - Hilda
let is_founded = (() =>
whitelist.find((e) => arg.startsWith(e)) !== undefined)();
if (is_founded === false) {
//this.Chat("This is sparta!");
return;
}
/*
if(arg.indexOf('~dartz/isos') !== -1 || arg.indexOf('~lily/ISOs') !== -1) {
this.Chat('Use the non-http versions of these commands for local images, please.');
return;
}
*/
/*if(arg.indexOf('crustywindo.ws') !== -1) { // make this an else if or bundle in previous if if latter is added back
this.Chat("Use the !crustycd command for the bootleg collection, please.");
return;
}*/ // wait im retarded whitelist
if (ext.toLowerCase() === "iso") this.QemuChangeCd(arg, "");
break;
case "httpflp":
//this.Chat("Disabled due to retards; sorry!");
//return;
if (
arg.indexOf("~dartz/isos") !== -1 ||
arg.indexOf("~lily/ISOs") !== -1
@ -562,9 +497,6 @@ class HelperBot extends CollabVMClient {
let arg = message.slice(message.indexOf(" ") + 1);
//this.Chat("sorry, severe autism not allowed right now");
//return;
switch (arg) {
case "cd":
this.QemuEjectCd();
@ -578,17 +510,11 @@ class HelperBot extends CollabVMClient {
case "reboot":
if (!DoLimit(this.RebootLimit!)) return;
// this.Chat("hold on fellas");
// return;
this.SendMonitorCommand("system_reset");
break;
case "bootset":
if (!DoLimit(this.GeneralCmdLimit!)) return;
//this.Chat("sorry, severe autism not allowed right now");
//return;
this.SendMonitorCommand(
`boot_set ${message.slice(message.indexOf(" ") + 1)}`,
);
@ -603,17 +529,12 @@ class HelperBot extends CollabVMClient {
CreateRateLimits() {
// Instanciate rate limit classes
// TODO: Should these be shared? idk
//if (vmId == 'vm0b0t')
// this.GeneralCmdLimit = new RateLimit(25 * 1000);
//else
this.GeneralCmdLimit = new RateLimit(
config.kGeneralLimitBaseSeconds * 1000,
2,
`General commands/${this._vmId}`,
);
//this.EjectLimit = new RateLimit(30 * 1000);
this.RebootLimit = new RateLimit(
config.kRebootLimitBaseSeconds * 1000,
3,
@ -628,8 +549,6 @@ class HelperBot extends CollabVMClient {
this.Close();
return;
}
//console.log(message);
Log(`[${this._vmId}]`, `Connected to VM`);
// I'm fucking lazy
@ -637,7 +556,6 @@ class HelperBot extends CollabVMClient {
this.CreateRateLimits();
}
// 5.admin,1.2,44.unknown command: &#x27;aaaaa&#x27;&#13;&#10;;
if (message[0] == "admin" && message[1] == "2") {
if (message[2].indexOf("Could not open") !== -1) {
this.Chat(
@ -648,7 +566,6 @@ class HelperBot extends CollabVMClient {
if (message[2].indexOf("boot device list now set to") !== -1) {
this.Chat("Successfully set boot order.");
}
//console.log(`Admin response: ${message[2]}`);
}
}
}