blob: 7587db7005bd0bd67bcdfe92095844023e7b4161 [file] [log] [blame]
pineafan63fc5e22022-08-04 22:04:10 +01001import { MessageEmbed } from "discord.js";
pineafan4f164f32022-02-26 22:07:12 +00002import getEmojiByName from "./getEmojiByName.js";
3
4const colors = {
5 "Danger": 0xF27878,
6 "Warning": 0xF2D478,
7 "Success": 0x68D49E
pineafan63fc5e22022-08-04 22:04:10 +01008};
pineafan4f164f32022-02-26 22:07:12 +00009
10class EmojiEmbed extends MessageEmbed {
11 _title: string;
12 _emoji: string;
13
pineafan63fc5e22022-08-04 22:04:10 +010014 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
pineafan4f164f32022-02-26 22:07:12 +000015 // @ts-ignore
16 // This *is* meant to be an accessor rather than a property
17 get title() {
18 return `${getEmojiByName(this._emoji)} ${this._title}`;
19 }
20
21 set title(title: string) {
22 this._title = title;
23 }
24
pineafan63fc5e22022-08-04 22:04:10 +010025 setTitle(title: string) { this._title = title; return this; }
26 setEmoji(emoji: string) { this._emoji = emoji; return this; }
27 setStatus(color: string) { this.setColor(colors[color]); return this; }
pineafan4f164f32022-02-26 22:07:12 +000028}
29
30export default EmojiEmbed;