mirror of https://github.com/clickscodes/nucleus
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.3 KiB
50 lines
1.3 KiB
import { EmbedBuilder } from "discord.js";
|
|
import getEmojiByName from "./getEmojiByName.js";
|
|
|
|
const colors = {
|
|
Danger: 0xf27878,
|
|
Warning: 0xf2d478,
|
|
Success: 0x68d49e
|
|
};
|
|
|
|
class EmojiEmbed extends EmbedBuilder {
|
|
_title = "";
|
|
_emoji: string | null = null;
|
|
description = "";
|
|
|
|
_generateTitle() {
|
|
if (this._emoji && !this._title) return getEmojiByName(this._emoji);
|
|
if (this._emoji) {
|
|
return `${getEmojiByName(this._emoji)} ${this._title}`;
|
|
}
|
|
if (this._title) {
|
|
return this._title;
|
|
}
|
|
return "";
|
|
}
|
|
|
|
override setTitle(title: string) {
|
|
this._title = title;
|
|
const proposedTitle = this._generateTitle();
|
|
if (proposedTitle) super.setTitle(proposedTitle);
|
|
return this;
|
|
}
|
|
override setDescription(description: string) {
|
|
this.description = description;
|
|
super.setDescription(description);
|
|
return this;
|
|
}
|
|
setEmoji(emoji: string) {
|
|
this._emoji = emoji;
|
|
const proposedTitle = this._generateTitle();
|
|
if (proposedTitle) super.setTitle(proposedTitle);
|
|
return this;
|
|
}
|
|
setStatus(color: "Danger" | "Warning" | "Success") {
|
|
this.setColor(colors[color]);
|
|
return this;
|
|
}
|
|
}
|
|
|
|
export default EmojiEmbed;
|