feat(polish): Adds EmbedLibrary
This commit is contained in:
parent
cf9c88a2d6
commit
b3d0b3a90c
12 changed files with 240 additions and 136 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import {inlineCode} from "discord.js";
|
||||
import {EmbedBuilder, inlineCode} from "discord.js";
|
||||
import {EmbedLibrary, EmbedType} from "./EmbedLibrary";
|
||||
|
||||
export class UserError extends Error {
|
||||
|
||||
|
|
@ -11,16 +12,23 @@ export class UserError extends Error {
|
|||
super(message);
|
||||
|
||||
}
|
||||
|
||||
public getEmbed(e: UserError): EmbedBuilder {
|
||||
const embed = EmbedLibrary.base(
|
||||
"Please validate your request!",
|
||||
inlineCode(e.message),
|
||||
EmbedType.Error
|
||||
).setFooter({
|
||||
text: "Type: Request"
|
||||
});
|
||||
|
||||
public getDiscordMessage(e: UserError): string {
|
||||
let userMessage = `:x: \`${e.message}\` - Please validate your request!`
|
||||
if (e.tryInstead) {
|
||||
userMessage += `
|
||||
|
||||
You can try the following:
|
||||
${inlineCode(e.tryInstead)}`
|
||||
embed.addFields({
|
||||
name: "You can try the following:",
|
||||
value: e.tryInstead
|
||||
})
|
||||
}
|
||||
|
||||
return userMessage;
|
||||
return embed;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue