get rid of snowflake stuff more

This commit is contained in:
MathMan05 2024-09-03 10:41:17 -05:00
parent 03041cf9fd
commit 004beb4955
13 changed files with 23 additions and 47 deletions

View file

@ -20,7 +20,6 @@ class Channel {
parent;
children;
guild_id;
messageids;
permission_overwrites;
permission_overwritesar;
topic;
@ -217,14 +216,13 @@ class Channel {
this.owner = owner;
this.headers = this.owner.headers;
this.name = json.name;
this.snowflake = new SnowFlake(json.id, this);
this.snowflake = new SnowFlake(json.id);
if (json.parent_id) {
this.parent_id = json.parent_id;
}
this.parent = null;
this.children = [];
this.guild_id = json.guild_id;
this.messageids = new Map();
this.permission_overwrites = new Map();
this.permission_overwritesar = [];
for (const thing of json.permission_overwrites) {
@ -758,9 +756,6 @@ class Channel {
this.lastmessageid = message.id;
}
prev = message;
if (this.messageids.get(message.snowflake) === undefined) {
this.messageids.set(message.snowflake, message);
}
}
}
delChannel(json) {
@ -795,7 +790,6 @@ class Channel {
this.idToPrev.set(messager.id, previd);
this.idToNext.set(previd, messager.id);
previd = messager.id;
this.messageids.set(messager.snowflake, messager);
if (willbreak) {
break;
}
@ -834,7 +828,6 @@ class Channel {
this.idToNext.set(messager.id, previd);
this.idToPrev.set(previd, messager.id);
previd = messager.id;
this.messageids.set(messager.snowflake, messager);
if (Number(i) === response.length - 1 && response.length < 100) {
this.topid = previd;
}
@ -953,7 +946,6 @@ class Channel {
}
this.children = [];
this.guild_id = json.guild_id;
this.messageids = new Map();
this.permission_overwrites = new Map();
for (const thing of json.permission_overwrites) {
if (thing.id === "1182819038095799904" || thing.id === "1182820803700625444") {
@ -1055,7 +1047,6 @@ class Channel {
this.idToPrev.set(messagez.id, this.lastmessageid);
}
this.lastmessageid = messagez.id;
this.messageids.set(messagez.snowflake, messagez);
if (messagez.author === this.localuser.user) {
this.lastreadmessageid = messagez.id;
if (this.myhtml) {

View file

@ -15,7 +15,7 @@ class Direct extends Guild {
this.headers = this.localuser.headers;
this.channels = [];
this.channelids = {};
this.snowflake = new SnowFlake("@me", this);
this.snowflake = new SnowFlake("@me");
this.properties = {};
this.roles = [];
this.roleids = new Map();
@ -88,12 +88,11 @@ class Group extends Channel {
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.parent_id = null;
this.parent = null;
this.children = [];
this.guild_id = "@me";
this.messageids = new Map();
this.permission_overwrites = new Map();
this.lastmessageid = json.last_message_id;
this.mentions = 0;
@ -142,7 +141,6 @@ class Group extends Channel {
this.idToPrev.set(messagez.id, this.lastmessageid);
}
this.lastmessageid = messagez.id;
this.messageids.set(messagez.snowflake, messagez);
if (messagez.author === this.localuser.user) {
this.lastreadmessageid = messagez.id;
if (this.myhtml) {

View file

@ -89,7 +89,7 @@ class Guild {
this.headers = this.owner.headers;
this.channels = [];
this.channelids = {};
this.snowflake = new SnowFlake(json.id, this);
this.snowflake = new SnowFlake(json.id);
this.properties = json.properties;
this.roles = [];
this.roleids = new Map();
@ -387,7 +387,7 @@ class Guild {
const build = { read_states: [] };
for (const thing of this.channels) {
if (thing.hasunreads) {
build.read_states.push({ channel_id: thing.snowflake, message_id: thing.lastmessageid, read_state_type: 0 });
build.read_states.push({ channel_id: thing.id, message_id: thing.lastmessageid, read_state_type: 0 });
thing.lastreadmessageid = thing.lastmessageid;
if (!thing.myhtml)
continue;

View file

@ -117,7 +117,7 @@ class Message {
continue;
}
else if (thing === "id") {
this.snowflake = new SnowFlake(messagejson.id, this);
this.snowflake = new SnowFlake(messagejson.id);
continue;
}
else if (thing === "member") {
@ -237,7 +237,6 @@ class Message {
this.channel.idToPrev.set(next, prev);
this.channel.idToNext.set(prev, next);
}
this.channel.messageids.delete(this.snowflake);
if (prev) {
const prevmessage = this.channel.messages.get(prev);
if (prevmessage) {

View file

@ -20,7 +20,7 @@ class Role {
this.info = owner.info;
for (const thing of Object.keys(json)) {
if (thing === "id") {
this.snowflake = new SnowFlake(json.id, this);
this.snowflake = new SnowFlake(json.id);
continue;
}
this[thing] = json[thing];

View file

@ -152,7 +152,7 @@ class User {
continue;
}
if (thing === "id") {
this.snowflake = new SnowFlake(userjson[thing], this);
this.snowflake = new SnowFlake(userjson[thing]);
continue;
}
this[thing] = userjson[thing];