pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 1 | import Discord, { CommandInteraction, ColorResolvable, MessageEmbed } from "discord.js"; |
| 2 | import getEmojiByName from "./getEmojiByName.js"; |
| 3 | |
| 4 | const colors = { |
| 5 | "Danger": 0xF27878, |
| 6 | "Warning": 0xF2D478, |
| 7 | "Success": 0x68D49E |
| 8 | } |
| 9 | |
| 10 | class EmojiEmbed extends MessageEmbed { |
| 11 | _title: string; |
| 12 | _emoji: string; |
| 13 | |
| 14 | // @ts-ignore |
| 15 | // This *is* meant to be an accessor rather than a property |
| 16 | get title() { |
| 17 | return `${getEmojiByName(this._emoji)} ${this._title}`; |
| 18 | } |
| 19 | |
| 20 | set title(title: string) { |
| 21 | this._title = title; |
| 22 | } |
| 23 | |
| 24 | setTitle(title: string) { this._title = title; return this } |
| 25 | setEmoji(emoji: string) { this._emoji = emoji; return this } |
| 26 | setStatus(color: string) { this.setColor(colors[color]); return this } |
| 27 | } |
| 28 | |
| 29 | export default EmojiEmbed; |