feat(permissions): Adds server permissions

This commit is contained in:
Michel Fedde 2025-06-24 20:58:46 +02:00
parent d46bbd84c5
commit cf9c88a2d6
24 changed files with 415 additions and 69 deletions

View file

@ -14,6 +14,7 @@ import {EventHandler} from "../Events/EventHandler";
import {ModalInteractionEvent} from "../Events/EventClasses/ModalInteractionEvent";
import {ComponentInteractionEvent} from "../Events/EventClasses/ComponentInteractionEvent";
import {log} from "node:util";
import {PermissionError} from "./PermissionError";
enum InteractionRoutingType {
Unrouted,
@ -95,17 +96,13 @@ export class InteractionRouter {
let userMessage = ":x: There was an error while executing this command!";
let logErrorMessage = true;
if (e.constructor.name === UserError.name) {
userMessage = `:x: \`${e.message}\` - Please validate your request!`
if (e.tryInstead) {
userMessage += `
You can try the following:
${inlineCode(e.tryInstead)}`
}
logErrorMessage = false;
if ("getDiscordMessage" in e) {
userMessage = e.getDiscordMessage(e);
}
if ("shouldLog" in e) {
logErrorMessage = e.shouldLog;
}
if (logErrorMessage) {
this.logger.error(e)