feat(permissions): Adds server permissions
This commit is contained in:
parent
d46bbd84c5
commit
cf9c88a2d6
24 changed files with 415 additions and 69 deletions
24
source/Discord/PermissionError.ts
Normal file
24
source/Discord/PermissionError.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import {inlineCode} from "discord.js";
|
||||
|
||||
export class PermissionError extends Error {
|
||||
shouldLog: boolean = false;
|
||||
|
||||
constructor(
|
||||
message: string,
|
||||
public readonly tryInstead: string | null = null
|
||||
) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public getDiscordMessage(e: PermissionError): string {
|
||||
let userMessage = `:x: You can not perform this action! ${inlineCode(e.message)}`
|
||||
if (e.tryInstead) {
|
||||
userMessage += `
|
||||
|
||||
You can try the following:
|
||||
${inlineCode(e.tryInstead)}`
|
||||
}
|
||||
|
||||
return userMessage;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue