33 lines
No EOL
682 B
TypeScript
33 lines
No EOL
682 B
TypeScript
import {EmbedBuilder, inlineCode} from "discord.js";
|
|
import {EmbedLibrary, EmbedType} from "./EmbedLibrary";
|
|
|
|
export class UserError extends Error {
|
|
|
|
shouldLog: boolean = false;
|
|
|
|
constructor(
|
|
message: string,
|
|
public readonly tryInstead: string | null = null
|
|
) {
|
|
super(message);
|
|
}
|
|
|
|
public getEmbed(e: UserError): EmbedBuilder {
|
|
const embed = EmbedLibrary.base(
|
|
"Please validate your request!",
|
|
e.message,
|
|
EmbedType.Error
|
|
).setFooter({
|
|
text: "Type: Request"
|
|
});
|
|
|
|
if (e.tryInstead) {
|
|
embed.addFields({
|
|
name: "You can try the following:",
|
|
value: e.tryInstead
|
|
})
|
|
}
|
|
|
|
return embed;
|
|
}
|
|
} |