check colors on discord embeds

This commit is contained in:
Jan 2022-07-18 20:14:05 +02:00
parent 00feba1ddb
commit fcfe5ea667
No known key found for this signature in database
GPG key ID: 5D5E18ACB990F57A
2 changed files with 2 additions and 2 deletions

View file

@ -191,7 +191,7 @@ async function sendLogMessage(config: LogConfig, content: LogMessage) {
const embed = new MessageEmbed(); const embed = new MessageEmbed();
if (c.title) embed.setTitle(content.title); if (c.title) embed.setTitle(content.title);
if (c.description) embed.setDescription(c.description); if (c.description) embed.setDescription(c.description);
if (c.color) embed.setColor(c.color as ColorResolvable); if (c.color?.match(/^#[0-9a-fA-F]+$/)) embed.setColor(c.color as ColorResolvable);
if (c.fields?.length) { if (c.fields?.length) {
for (const field of c.fields) { for (const field of c.fields) {
embed.addField(field.title, field.content.trim() || "\u200b", field.inline); embed.addField(field.title, field.content.trim() || "\u200b", field.inline);

View file

@ -19,7 +19,7 @@ export default class GenericEmbed {
if (embed.title) this.title = embed.title; if (embed.title) this.title = embed.title;
if (embed.description) this.description = embed.description; if (embed.description) this.description = embed.description;
if (embed.icon_url?.match(/^http(s)?\:\/\//)) this.icon = embed.icon_url; if (embed.icon_url?.match(/^http(s)?\:\/\//)) this.icon = embed.icon_url;
if (embed.colour) this.color = (embed.colour as any); if (embed.colour?.match(/^#[0-9a-fA-F]+$/)) this.color = (embed.colour as any);
if (embed.url) this.url = embed.url; if (embed.url) this.url = embed.url;
} }
} }