make guild icons update
This commit is contained in:
parent
a2a53e5c88
commit
cf820653ee
3 changed files with 14 additions and 4 deletions
|
@ -440,8 +440,14 @@ class Guild extends SnowFlake {
|
|||
this.emojis = json.emojis;
|
||||
this.headers = this.owner.headers;
|
||||
this.channels = [];
|
||||
|
||||
this.roles = [];
|
||||
if (this.properties.icon !== json.icon) {
|
||||
this.properties.icon = json.icon;
|
||||
if (this.HTMLicon) {
|
||||
const divy = this.generateGuildIcon();
|
||||
this.HTMLicon.replaceWith(divy);
|
||||
this.HTMLicon = divy;
|
||||
}
|
||||
}
|
||||
this.roleids = new Map();
|
||||
this.banner = json.banner;
|
||||
}
|
||||
|
@ -666,6 +672,7 @@ class Guild extends SnowFlake {
|
|||
return a.position - b.position;
|
||||
});
|
||||
}
|
||||
HTMLicon?: HTMLElement;
|
||||
static generateGuildIcon(guild: Guild | (invitejson["guild"] & {info: {cdn: string}})) {
|
||||
const divy = document.createElement("div");
|
||||
divy.classList.add("servernoti");
|
||||
|
|
|
@ -490,8 +490,10 @@ class Localuser {
|
|||
const guildy = new Guild(temp.d, this, this.user);
|
||||
this.guilds.push(guildy);
|
||||
this.guildids.set(guildy.id, guildy);
|
||||
const divy = guildy.generateGuildIcon();
|
||||
guildy.HTMLicon = divy;
|
||||
(document.getElementById("servers") as HTMLDivElement).insertBefore(
|
||||
guildy.generateGuildIcon(),
|
||||
divy,
|
||||
document.getElementById("bottomseparator"),
|
||||
);
|
||||
})();
|
||||
|
@ -966,6 +968,7 @@ class Localuser {
|
|||
continue;
|
||||
}
|
||||
const divy = thing.generateGuildIcon();
|
||||
thing.HTMLicon = divy;
|
||||
serverlist.append(divy);
|
||||
}
|
||||
{
|
||||
|
|
|
@ -387,7 +387,7 @@ class Member extends SnowFlake {
|
|||
}
|
||||
static async resolveMember(user: User, guild: Guild): Promise<Member | undefined> {
|
||||
const maybe = user.members.get(guild);
|
||||
if (!user.members.has(guild)) {
|
||||
if (!maybe) {
|
||||
const membpromise = guild.localuser.resolvemember(user.id, guild.id);
|
||||
const promise = new Promise<Member | undefined>(async (res) => {
|
||||
const membjson = await membpromise;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue