various improvements and fixes

fixes a DM bug, and improves mention handling
This commit is contained in:
MathMan05
2024-12-09 14:51:24 -06:00
parent a22c2f10c0
commit 127a9e8250
6 changed files with 84 additions and 34 deletions

View File

@@ -588,27 +588,42 @@ class Guild extends SnowFlake{
headers: this.headers,
});
}
get mentions(){
let mentions=0;
for(const thing of this.channels){
mentions+=thing.mentions;
}
return mentions;
}
unreads(html?: HTMLElement | undefined){
if(html){
this.html = html;
}else{
html = this.html;
}
if(!html){
return;
}
let read = true;
let mentions=this.mentions;
for(const thing of this.channels){
if(thing.hasunreads){
console.log(thing);
read = false;
break;
}
}
if(!html){
return;
const noti=html.children[0];
if(mentions!==0){
noti.classList.add("pinged");
noti.textContent=""+mentions;
}else{
noti.textContent="";
noti.classList.remove("pinged");
}
if(read){
html.children[0].classList.remove("notiunread");
noti.classList.remove("notiunread");
}else{
html.children[0].classList.add("notiunread");
noti.classList.add("notiunread");
}
}
getHTML(){