pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame^] | 1 | import { MessageEmbed } from "discord.js"; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 2 | import getEmojiByName from "./getEmojiByName.js"; |
| 3 | |
| 4 | const colors = { |
| 5 | "Danger": 0xF27878, |
| 6 | "Warning": 0xF2D478, |
| 7 | "Success": 0x68D49E |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame^] | 8 | }; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 9 | |
| 10 | class EmojiEmbed extends MessageEmbed { |
| 11 | _title: string; |
| 12 | _emoji: string; |
| 13 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame^] | 14 | // eslint-disable-next-line @typescript-eslint/ban-ts-comment |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 15 | // @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 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame^] | 25 | 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; } |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | export default EmojiEmbed; |