fix id and snowflake

This commit is contained in:
MathMan05 2024-07-24 12:53:30 -05:00
parent 5e9405207b
commit 4f80104e2e
17 changed files with 263 additions and 235 deletions

View file

@ -7,13 +7,16 @@ class User {
static userids = {};
owner;
hypotheticalpfp;
id;
snowflake;
avatar;
username;
bio;
discriminator;
pronouns;
bot;
get id() {
return this.snowflake.id;
}
static contextmenu = new Contextmenu("User Menu");
static setUpContextMenu() {
this.contextmenu.addbutton("Copy user id", function () {
@ -54,7 +57,7 @@ class User {
continue;
}
if (thing === "id") {
this.id = new SnowFlake(userjson[thing], this);
this.snowflake = new SnowFlake(userjson[thing], this);
continue;
}
this[thing] = userjson[thing];
@ -72,7 +75,7 @@ class User {
const pfp = document.createElement('img');
pfp.src = this.getpfpsrc();
pfp.classList.add("pfp");
pfp.classList.add("userid:" + this.id.id);
pfp.classList.add("userid:" + this.id);
return pfp;
}
userupdate(json) {
@ -82,7 +85,7 @@ class User {
}
}
bind(html, guild = null) {
if (guild && guild.id.id !== "@me") {
if (guild && guild.id !== "@me") {
Member.resolve(this, guild).then(_ => {
_.bind(html);
}).catch(_ => {
@ -101,7 +104,7 @@ class User {
this.hypotheticalpfp = false;
const src = this.getpfpsrc();
console.log(src);
for (const thing of document.getElementsByClassName("userid:" + this.id.id)) {
for (const thing of document.getElementsByClassName("userid:" + this.id)) {
thing.src = src;
}
}
@ -110,7 +113,7 @@ class User {
return this.avatar;
}
if (this.avatar != null) {
return this.info.cdn.toString() + "avatars/" + this.id.id + "/" + this.avatar + ".png";
return this.info.cdn.toString() + "avatars/" + this.id + "/" + this.avatar + ".png";
}
else {
return this.info.cdn.toString() + "embed/avatars/3.png";