import {EmbedBuilder, inlineCode} from "discord.js"; import {EmbedLibrary, EmbedType} from "./EmbedLibrary"; export class PermissionError extends Error { shouldLog: boolean = false; constructor( message: string, public readonly tryInstead: string | null = null ) { super(message); } public getEmbed(e: PermissionError): EmbedBuilder { const embed = EmbedLibrary.base( "You can not perform this action!", inlineCode(e.message), EmbedType.Error ).setFooter({ text: "Type: Permission" }); if (e.tryInstead) { embed.addFields({ name: "You can try the following:", value: e.tryInstead }) } return embed; } }