blob: e1b481afc8e47d8b739f9dbfb0e0b0e9f6cc9a7b [file] [log] [blame]
PineaFandf4996f2023-01-01 14:20:06 +00001import { EmbedBuilder } from "@discordjs/builders";
pineafan4f164f32022-02-26 22:07:12 +00002import getEmojiByName from "./getEmojiByName.js";
3
4const colors = {
Skyler Grey75ea9172022-08-06 10:22:23 +01005 Danger: 0xf27878,
6 Warning: 0xf2d478,
7 Success: 0x68d49e
pineafan63fc5e22022-08-04 22:04:10 +01008};
pineafan4f164f32022-02-26 22:07:12 +00009
TheCodedProf21c08592022-09-13 14:14:43 -040010class EmojiEmbed extends EmbedBuilder {
pineafanbd02b4a2022-08-05 22:01:38 +010011 _title = "";
12 _emoji: string | null = null;
pineafan4f164f32022-02-26 22:07:12 +000013
PineaFandf4996f2023-01-01 14:20:06 +000014 _generateTitle() {
15 if (this._emoji) { return `${getEmojiByName(this._emoji)} ${this._title}`; }
16 return this._title;
pineafan4f164f32022-02-26 22:07:12 +000017 }
18
Skyler Grey75ea9172022-08-06 10:22:23 +010019 override setTitle(title: string) {
20 this._title = title;
PineaFandf4996f2023-01-01 14:20:06 +000021 super.setTitle(this._generateTitle());
Skyler Grey75ea9172022-08-06 10:22:23 +010022 return this;
23 }
24 setEmoji(emoji: string) {
25 this._emoji = emoji;
PineaFandf4996f2023-01-01 14:20:06 +000026 super.setTitle(this._generateTitle());
Skyler Grey75ea9172022-08-06 10:22:23 +010027 return this;
28 }
29 setStatus(color: "Danger" | "Warning" | "Success") {
30 this.setColor(colors[color]);
31 return this;
32 }
pineafan4f164f32022-02-26 22:07:12 +000033}
34
PineaFandf4996f2023-01-01 14:20:06 +000035
Skyler Grey75ea9172022-08-06 10:22:23 +010036export default EmojiEmbed;