general changes and reducing logs

This commit is contained in:
MathMan05
2024-07-27 12:51:42 -05:00
parent 0d757b7d4e
commit 7a745a5286
16 changed files with 146 additions and 78 deletions

View File

@@ -7,7 +7,6 @@ class Direct extends Guild {
constructor(json, owner) {
super(-1, owner, null);
this.message_notifications = 0;
console.log(json);
this.owner = owner;
if (!this.localuser) {
console.error("Owner was not included, please fix");
@@ -169,13 +168,11 @@ class Group extends Channel {
const noti = document.createElement("div");
noti.classList.add("unread", "notiunread", "pinged");
noti.textContent = "" + this.mentions;
console.log(this.mentions);
div["noti"] = noti;
div.append(noti);
const buildpfp = this.user.buildpfp();
div["all"] = this;
buildpfp.classList.add("mentioned");
console.log(this);
div.append(buildpfp);
sentdms.append(div);
div.onclick = _ => {

View File

@@ -5,7 +5,6 @@ class Embed {
owner;
json;
constructor(json, owner) {
console.log(json);
this.type = this.getType(json);
this.owner = owner;
this.json = json;
@@ -41,7 +40,6 @@ class Embed {
return this.guild.localuser;
}
generateRich() {
console.log(this.json);
const div = document.createElement("div");
if (this.json.color) {
div.style.backgroundColor = "#" + this.json.color.toString(16);

View File

@@ -10,7 +10,6 @@ class File {
url;
size;
constructor(fileJSON, owner) {
console.log(fileJSON);
this.owner = owner;
this.id = fileJSON.id;
this.filename = fileJSON.filename;

View File

@@ -288,7 +288,6 @@ class Localuser {
if (!guild) {
guild = this.guildids.get("@me");
}
console.log(this.guildids, id, guild);
if (this.lookingguild) {
this.lookingguild.html.classList.remove("serveropen");
}
@@ -345,7 +344,6 @@ class Localuser {
div.classList.add("home", "servericon");
serverlist.appendChild(div);
div.onclick = _ => {
console.log("clicked :3");
this.createGuild();
};
const guildDiscoveryContainer = document.createElement("div");
@@ -356,7 +354,6 @@ class Localuser {
this.guildDiscovery();
});
}
console.log("test");
this.unreads();
}
createGuild() {
@@ -369,7 +366,6 @@ class Localuser {
"Invite Link/Code",
"",
function () {
console.log(this);
inviteurl = this.value;
}
],
@@ -389,7 +385,6 @@ class Localuser {
method: "POST",
headers: this.headers,
}).then(r => r.json()).then(_ => {
console.log(_);
if (_.message) {
error.textContent = _.message;
}
@@ -463,13 +458,11 @@ class Localuser {
this.unreads();
}
unreads() {
console.log(this.guildhtml);
for (const thing of this.guilds) {
if (thing.id === "@me") {
continue;
}
const html = this.guildhtml.get(thing.id);
console.log(html);
thing.unreads(html);
}
}
@@ -506,7 +499,6 @@ class Localuser {
updatepfp(file) {
var reader = new FileReader();
reader.readAsDataURL(file);
console.log(this.headers);
reader.onload = () => {
fetch(this.info.api.toString() + "/users/@me", {
method: "PATCH",
@@ -515,7 +507,6 @@ class Localuser {
avatar: reader.result,
})
});
console.log(reader.result);
};
}
updatepronouns(pronouns) {
@@ -559,7 +550,6 @@ class Localuser {
else {
build += " is typing";
}
console.log(typingtext.classList);
if (showing) {
typingtext.classList.remove("hidden");
document.getElementById("typingtext").textContent = build;
@@ -573,7 +563,7 @@ class Localuser {
let file = null;
let newprouns = null;
let newbio = null;
let hypouser = new User(this.user, this, true);
let hypouser = this.user.clone();
function regen() {
hypotheticalProfile.textContent = "";
const hypoprofile = hypouser.buildprofile(-1, -1);

View File

@@ -54,12 +54,11 @@ class Member {
this.user = memberjson;
}
else {
console.log(this.user, memberjson);
if (SnowFlake.getSnowFlakeFromID(this?.id, User)) {
this.user = SnowFlake.getSnowFlakeFromID(this.id, User).getObject();
return;
}
this.user = new User(this.user, owner.localuser);
this.user = new User(membery.user, owner.localuser);
}
}
get guild() {

View File

@@ -62,7 +62,6 @@ class Message {
this.giveData(messagejson);
}
giveData(messagejson) {
console.log(messagejson);
for (const thing of Object.keys(messagejson)) {
if (thing === "attachments") {
this.attachments = [];
@@ -83,15 +82,19 @@ class Message {
this.member = new Member(messagejson.member, this.guild);
continue;
}
else if (thing === "embeds") {
this.embeds = [];
for (const thing in messagejson.embeds) {
console.log(thing, messagejson.embeds);
this.embeds[thing] = new Embed(messagejson.embeds[thing], this);
}
continue;
}
this[thing] = messagejson[thing];
}
for (const thing in this.embeds) {
console.log(thing, this.embeds);
this.embeds[thing] = new Embed(this.embeds[thing], this);
}
this.author = new User(this.author, this.localuser);
for (const thing in this.mentions) {
this.mentions[thing] = new User(this.mentions[thing], this.localuser);
this.author = new User(messagejson.author, this.localuser);
for (const thing in messagejson.mentions) {
this.mentions[thing] = new User(messagejson.mentions[thing], this.localuser);
}
if (!this.member && this.guild.id !== "@me") {
this.author.resolvemember(this.guild).then(_ => {
@@ -311,6 +314,7 @@ class Message {
messagedwrap.appendChild(attach);
}
if (this.embeds.length) {
console.log(this.embeds);
const embeds = document.createElement("div");
embeds.classList.add("flexltr");
for (const thing of this.embeds) {

View File

@@ -14,6 +14,31 @@ class User {
discriminator;
pronouns;
bot;
public_flags;
accent_color;
banner;
premium_since;
premium_type;
theme_colors;
badge_ids;
clone() {
return new User({
username: this.username,
id: this.id + "#clone",
public_flags: this.public_flags,
discriminator: this.discriminator,
avatar: this.avatar,
accent_color: this.accent_color,
banner: this.banner,
bio: this.bio.rawString,
premium_since: this.premium_since,
premium_type: this.premium_type,
bot: this.bot,
theme_colors: this.theme_colors,
pronouns: this.pronouns,
badge_ids: this.badge_ids
}, this.owner);
}
get id() {
return this.snowflake.id;
}
@@ -29,13 +54,13 @@ class User {
});
});
}
static checkuser(userjson, owner) {
if (User.userids[userjson.id]) {
return User.userids[userjson.id];
static checkuser(user, owner) {
if (User.userids[user.id]) {
return User.userids[user.id];
}
else {
const tempuser = new User(userjson, owner, true);
User.userids[userjson.id] = tempuser;
const tempuser = new User(user, owner, true);
User.userids[user.id] = tempuser;
return tempuser;
}
}