Correcting names, and deleting message
There is a known regresion for the MESSAGE_CREATE event while it's not on screen, though I have not been able to replicate it while I'm looking for it. If you see this bug, please let me know the conditions it happens under
This commit is contained in:
parent
845c7f6612
commit
ac939e5fb6
17 changed files with 473 additions and 166 deletions
|
@ -2,7 +2,6 @@ import { Guild } from "./guild.js";
|
|||
import { Direct } from "./direct.js";
|
||||
import { Voice } from "./audio.js";
|
||||
import { User } from "./user.js";
|
||||
import { Member } from "./member.js";
|
||||
import { markdown } from "./markdown.js";
|
||||
import { Fullscreen } from "./fullscreen.js";
|
||||
import { setTheme } from "./login.js";
|
||||
|
@ -48,8 +47,12 @@ class Localuser {
|
|||
this.channelfocus = null;
|
||||
this.lookingguild = null;
|
||||
this.guildhtml = {};
|
||||
const members = {};
|
||||
for (const thing of ready.d.merged_members) {
|
||||
members[thing[0].guild_id] = thing[0];
|
||||
}
|
||||
for (const thing of ready.d.guilds) {
|
||||
const temp = new Guild(thing, this);
|
||||
const temp = new Guild(thing, this, members[thing.id]);
|
||||
this.guilds.push(temp);
|
||||
this.guildids[temp.id] = temp;
|
||||
}
|
||||
|
@ -62,11 +65,6 @@ class Localuser {
|
|||
for (const thing of ready.d.user_guild_settings.entries) {
|
||||
this.guildids[thing.guild_id].notisetting(thing);
|
||||
}
|
||||
for (const thing of ready.d.merged_members) {
|
||||
const guild = this.guildids[thing[0].guild_id];
|
||||
const temp = new Member(thing[0], guild);
|
||||
guild.giveMember(temp);
|
||||
}
|
||||
for (const thing of ready.d.read_state.entries) {
|
||||
const guild = this.resolveChannelFromID(thing.id).guild;
|
||||
if (guild === undefined) {
|
||||
|
@ -130,6 +128,10 @@ class Localuser {
|
|||
this.messageCreate(temp);
|
||||
}
|
||||
break;
|
||||
case "MESSAGE_DELETE":
|
||||
console.log(temp.d);
|
||||
this.guildids[temp.d.guild_id].channelids[temp.d.channel_id].messageids[temp.d.id].deleteEvent();
|
||||
break;
|
||||
case "READY":
|
||||
this.gottenReady(temp);
|
||||
this.genusersettings();
|
||||
|
@ -193,7 +195,7 @@ class Localuser {
|
|||
}
|
||||
case "GUILD_CREATE":
|
||||
{
|
||||
const guildy = new Guild(temp.d, this);
|
||||
const guildy = new Guild(temp.d, this, this.user);
|
||||
this.guilds.push(guildy);
|
||||
this.guildids[guildy.id] = guildy;
|
||||
document.getElementById("servers").insertBefore(guildy.generateGuildIcon(), document.getElementById("bottomseperator"));
|
||||
|
@ -236,7 +238,6 @@ class Localuser {
|
|||
return;
|
||||
}
|
||||
resolveChannelFromID(ID) {
|
||||
console.log(this.guilds.find(guild => guild.channelids[ID]).channelids);
|
||||
let resolve = this.guilds.find(guild => guild.channelids[ID]).channelids[ID];
|
||||
resolve ??= undefined;
|
||||
return resolve;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue