make MarkDown into a class and fixed emojis

This commit is contained in:
MathMan05 2024-07-20 19:05:23 -05:00
parent 36fc3fecc2
commit ec5b86b276
12 changed files with 957 additions and 848 deletions

View file

@ -1,6 +1,6 @@
import {Fullscreen} from "./fullscreen.js";
import {Message} from "./message.js";
import {markdown} from "./markdown.js";
import {MarkDown} from "./markdown.js";
class Embed{
type:string;
@ -29,6 +29,18 @@ class Embed{
return document.createElement("div");//prevent errors by giving blank div
}
}
get message(){
return this.owner;
}
get channel(){
return this.message.channel;
}
get guild(){
return this.channel.guild;
}
get localuser(){
return this.guild.localuser;
}
generateRich(){
console.log(this.json)
const div=document.createElement("div");
@ -59,7 +71,7 @@ class Embed{
embed.append(authorline);
}
const title=document.createElement("a");
title.append(markdown(this.json.title));
title.append(new MarkDown(this.json.title,this.localuser).makeHTML());
if(this.json.url){
title.href=this.json.url;
}
@ -68,7 +80,7 @@ class Embed{
if(this.json.description){
const p=document.createElement("p");
p.append(markdown(this.json.description));
p.append(new MarkDown(this.json.description,this.channel).makeHTML());
embed.append(p);
}
@ -80,7 +92,7 @@ class Embed{
b.textContent=thing.name;
div.append(b);
const p=document.createElement("p")
p.append(markdown(thing.value));
p.append(new MarkDown(thing.value,this.channel).makeHTML());
p.classList.add("embedp");
div.append(p);