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

@ -60,12 +60,12 @@ class Localuser {
for (const thing of ready.d.guilds) {
const temp = new Guild(thing, this, members[thing.id]);
this.guilds.push(temp);
this.guildids[temp.id.id] = temp;
this.guildids[temp.id] = temp;
}
{
const temp = new Direct(ready.d.private_channels, this);
this.guilds.push(temp);
this.guildids[temp.id.id] = temp;
this.guildids[temp.id] = temp;
}
console.log(ready.d.user_guild_settings.entries);
for (const thing of ready.d.user_guild_settings.entries) {
@ -80,7 +80,7 @@ class Localuser {
if (guild === undefined) {
continue;
}
const guildid = guild.id;
const guildid = guild.snowflake;
this.guildids[guildid.id].channelids[thing.channel_id].readStateInfo(thing);
}
this.typing = [];
@ -193,7 +193,7 @@ class Localuser {
{
const guildy = new Guild(temp.d, this, this.user);
this.guilds.push(guildy);
this.guildids[guildy.id.id] = guildy;
this.guildids[guildy.id] = guildy;
document.getElementById("servers").insertBefore(guildy.generateGuildIcon(), document.getElementById("bottomseparator"));
}
}
@ -251,21 +251,21 @@ class Localuser {
}
updateChannel(JSON) {
SnowFlake.getSnowFlakeFromID(JSON.guild_id, Guild).getObject().updateChannel(JSON);
if (JSON.guild_id === this.lookingguild.id.id) {
if (JSON.guild_id === this.lookingguild.id) {
this.loadGuild(JSON.guild_id);
}
}
createChannel(JSON) {
JSON.guild_id ??= "@me";
SnowFlake.getSnowFlakeFromID(JSON.guild_id, Guild).getObject().createChannelpac(JSON);
if (JSON.guild_id === this.lookingguild.id.id) {
if (JSON.guild_id === this.lookingguild.id) {
this.loadGuild(JSON.guild_id);
}
}
delChannel(JSON) {
JSON.guild_id ??= "@me";
this.guildids[JSON.guild_id].delChannel(JSON);
if (JSON.guild_id === this.lookingguild.id) {
if (JSON.guild_id === this.lookingguild.snowflake) {
this.loadGuild(JSON.guild_id);
}
}
@ -466,17 +466,17 @@ class Localuser {
unreads() {
console.log(this.guildhtml);
for (const thing of this.guilds) {
if (thing.id.id === "@me") {
if (thing.id === "@me") {
continue;
}
thing.unreads(this.guildhtml[thing.id.id]);
thing.unreads(this.guildhtml[thing.id]);
}
}
typingStart(typing) {
if (this.channelfocus.id === typing.d.channel_id) {
if (this.channelfocus.snowflake === typing.d.channel_id) {
const memb = typing.d.member;
let name;
if (memb.id === this.user.id) {
if (memb.id === this.user.snowflake) {
console.log("you is typing");
return;
}