Skip to content

Commit

Permalink
Base User class
Browse files Browse the repository at this point in the history
  • Loading branch information
PurpleCreativity committed Dec 15, 2024
1 parent 1035f49 commit 8a124ca
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/classes/legacy/User.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import type BloxFetch from "../../main.js";
import type { rawUserData } from "../../main.js";

export default class User {
readonly client: BloxFetch;
private rawData: rawUserData;

readonly id: number;
readonly name: string;
readonly displayName: string;
readonly description: string;
readonly hasVerifiedBadge: boolean;
readonly externalAppDisplayName?: string;
readonly isBanned: boolean;
readonly joinDate: Date;

constructor(client: BloxFetch, rawData: rawUserData) {
this.client = client;
this.rawData = rawData;

this.id = rawData.id;
this.name = rawData.name;
this.displayName = rawData.displayName;
this.description = rawData.description;
this.hasVerifiedBadge = rawData.hasVerifiedBadge;
this.externalAppDisplayName = rawData.externalAppDisplayName;
this.isBanned = rawData.isBanned;
this.joinDate = new Date(rawData.created);
}

get profileLink(): string {
return `https://www.roblox.com/users/${this.id}/profile`;
}

get accountAge(): number {
return Math.ceil(Math.abs(new Date().getTime() - this.joinDate.getTime()) / (1000 * 60 * 60 * 24));
}
}

0 comments on commit 8a124ca

Please sign in to comment.