updates to local

This commit is contained in:
MathMan05 2024-07-25 12:07:57 -05:00
parent 71c281ec2b
commit 0cbc1a7910
6 changed files with 67 additions and 70 deletions

View file

@ -4,10 +4,10 @@ import { Message } from "./message.js";
import { User } from "./user.js";
import { SnowFlake } from "./snowflake.js";
class Direct extends Guild {
constructor(JSON, owner) {
constructor(json, owner) {
super(-1, owner, null);
this.message_notifications = 0;
console.log(JSON);
console.log(json);
this.owner = owner;
if (!this.localuser) {
console.error("Owner was not included, please fix");
@ -21,16 +21,16 @@ class Direct extends Guild {
this.roleids = new Map();
this.prevchannel = undefined;
this.properties.name = "Direct Messages";
for (const thing of JSON) {
for (const thing of json) {
const temp = new Group(thing, this);
this.channels.push(temp);
this.channelids[temp.id] = temp;
}
this.headchannels = this.channels;
}
createChannelpac(JSON) {
const thischannel = new Group(JSON, this);
this.channelids[JSON.id] = thischannel;
createChannelpac(json) {
const thischannel = new Group(json, this);
this.channelids[json.id] = thischannel;
this.channels.push(thischannel);
this.calculateReorder();
this.printServers();
@ -61,26 +61,26 @@ class Direct extends Guild {
}
class Group extends Channel {
user;
constructor(JSON, owner) {
constructor(json, owner) {
super(-1, owner);
this.owner = owner;
this.headers = this.guild.headers;
this.name = JSON.recipients[0]?.username;
if (JSON.recipients[0]) {
this.user = new User(JSON.recipients[0], this.localuser);
this.name = json.recipients[0]?.username;
if (json.recipients[0]) {
this.user = new User(json.recipients[0], this.localuser);
}
else {
this.user = this.localuser.user;
}
this.name ??= this.localuser.user.username;
this.snowflake = new SnowFlake(JSON.id, this);
this.snowflake = new SnowFlake(json.id, this);
this.parent_id = null;
this.parent = null;
this.children = [];
this.guild_id = "@me";
this.messageids = new Map();
this.permission_overwrites = new Map();
this.lastmessageid = SnowFlake.getSnowFlakeFromID(JSON.last_message_id, Message);
this.lastmessageid = SnowFlake.getSnowFlakeFromID(json.last_message_id, Message);
this.lastmessageid ??= new SnowFlake("0", undefined);
this.mentions = 0;
this.setUpInfiniteScroller();