summary refs log tree commit diff
path: root/user.js
diff options
context:
space:
mode:
Diffstat (limited to 'user.js')
-rw-r--r--user.js33
1 files changed, 0 insertions, 33 deletions
diff --git a/user.js b/user.js
deleted file mode 100644
index c801659..0000000
--- a/user.js
+++ /dev/null
@@ -1,33 +0,0 @@
-// because why not make *more files
-
-import { getRandomInt } from "./lib.js";
-import cuid from "cuid";
-
-export default class User {
-    /**
-     * the user class
-     * @param {import("node:http").IncomingMessage} request request
-     * @param {WebSocket} socket socket
-     * @param {import("./server.ts").Server} server the server
-     */
-    constructor (request, socket, server) {
-        this.id = cuid();
-        const anonID = getRandomInt(0, 99999);
-        const annonNum = "0".repeat(5 - anonID.toString().length) + anonID.toString()
-        this.username = server.config.annonFormat ? server.config.annonFormat.replace('[num]', annonNum) : 'Anonymous' + annonNum;
-        this.nickname = server.config.annonFormat ? server.config.annonFormat.replace('[num]', annonNum) : 'Anonymous' + annonNum;
-        this.guest = true;
-        this.socket = socket;
-        this.joinReq = request;
-        this.ip = request.headers["x-forwarded-for"] || request.socket.remoteAddress;
-        this.t = {
-            js: Number(new Date()),
-            unix: Math.floor(new Date().getTime() / 1000),
-            str: String(new Date()),
-        };
-        this.channel = "home";
-        this.name = function () {
-            return this.nickname != "" ? this.nickname : this.username;
-        };
-    }
-}
\ No newline at end of file