added embed colors

This commit is contained in:
Supositware 2019-02-10 02:11:53 +01:00
parent 94f8f62952
commit 8d22b74f06

View file

@ -56,11 +56,12 @@ class messageListener extends Listener {
if (text.includes('[embed]')) { if (text.includes('[embed]')) {
text = text.replace(/\[embed\]/, ' '); text = text.replace(/\[embed\]/, ' ');
let title; let title = '';
let desc; let desc = '';
let image; let image;
let thumbnail; let thumbnail;
let footer; let footer = '';
let color;
if (text.includes('[embedImage:')) { if (text.includes('[embedImage:')) {
image = text.split(/(\[embedImage:.*?])/); image = text.split(/(\[embedImage:.*?])/);
@ -86,6 +87,18 @@ class messageListener extends Listener {
} }
} }
if (text.includes('[embedColor:')) {
color = text.split(/(\[embedColor:.*?])/);
for (let i = 0, l = color.length; i < l; i++) {
if (color[i].includes('[embedColor:')) {
color = color[i].replace('[embedColor:', '').slice(0, -1);
text = text.replace(/(\[embedColor:.*?])/g, '');
i = color.length;
}
}
}
if (text.includes('[embedTitle:')) { if (text.includes('[embedTitle:')) {
title = text.split(/(\[embedTitle:.*?])/); title = text.split(/(\[embedTitle:.*?])/);
for (let i = 0, l = title.length; i < l; i++) { for (let i = 0, l = title.length; i < l; i++) {
@ -120,7 +133,7 @@ class messageListener extends Listener {
} }
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setColor() .setColor(color)
.setTitle(title) .setTitle(title)
.setImage(image) .setImage(image)
.setThumbnail(thumbnail) .setThumbnail(thumbnail)