More embed fixes

This commit is contained in:
MathMan05
2024-06-20 14:09:19 -05:00
parent 8ed79005fd
commit c28ca422ec

View File

@@ -37,27 +37,31 @@ class embed{
title.textContent=this.json.title; title.textContent=this.json.title;
embed.append(title); embed.append(title);
embed.append(document.createElement("br")); embed.append(document.createElement("br"));
for(const thing of this.json.fields){ if(this.json.fields){
const b=document.createElement("b"); for(const thing of this.json.fields){
b.textContent=thing.name; const b=document.createElement("b");
embed.append(b); b.textContent=thing.name;
embed.append(document.createElement("br")); embed.append(b);
const p=document.createElement("p") embed.append(document.createElement("br"));
p.textContent=thing.value; const p=document.createElement("p")
p.classList.add("embedp") p.textContent=thing.value;
embed.append(p); p.classList.add("embedp")
embed.append(p);
}
} }
const footer=document.createElement("div"); if(this.json.footer){
if(this.json.footer.icon_url){ const footer=document.createElement("div");
const img=document.createElement("img"); if(this.json.footer.icon_url){
img.src=this.json.footer.icon_url; const img=document.createElement("img");
img.classList.add("embedicon"); img.src=this.json.footer.icon_url;
footer.append(img); img.classList.add("embedicon");
footer.append(img);
}
if(this.json.footer.text){
footer.append(this.json.footer.text);
}
embed.append(footer);
} }
if(this.json.footer.text){
footer.append(this.json.footer.text);
}
embed.append(footer);
return div; return div;
} }
generateImage(){ generateImage(){