system messages types WIP

This commit is contained in:
mmacierzanka committed 2021-08-02 22:18:24 +02:00
1 parent a636960957
commit 7250cace67
2 files changed
+26 -2

No files matched your search

+1 -1
View File
@@ -268,7 +268,7 @@ export class CommandManager {
) {
argumentsList.splice(0, 1);
}
if (command.arguments) {
if (command.arguments.length > 0) {
command.arguments.map((a, i) => {
if (!argumentsList[i] && !a.optional) {
throw new MissingArgumentError(a);
+25 -1
View File
@@ -11,7 +11,11 @@ import {
import { Command } from "./Command.js";
import { PermissionsError } from "./Error.js";
export type MessageType = "PERMISSION" | "ERROR" | "NOT_FOUND";
export type MessageType =
| "PERMISSION"
| "ERROR"
| "NOT_FOUND"
| "MISSING_ARGUMENT";
export interface SystemMessageAppearance {
enabled: boolean;
title: string;
@@ -31,6 +35,8 @@ export class SystemMessageManager {
PERMISSION: SystemMessageAppearance;
ERROR: SystemMessageAppearance;
NOT_FOUND: SystemMessageAppearance;
MISSING_ARGUMENT: SystemMessageAppearance;
ARGUMENT_TYPE_MISMATCH: SystemMessageAppearance;
deleteTimeout: number;
constructor(botName?: string) {
@@ -57,6 +63,23 @@ export class SystemMessageManager {
showTimestamp: true,
footer: botName,
};
this.MISSING_ARGUMENT = {
enabled: true,
title: "🛑 Missing arguments",
bottomText:
"This command requires an argument that you didn't provide",
accentColor: "#ff0000",
showTimestamp: true,
footer: botName,
};
this.ARGUMENT_TYPE_MISMATCH = {
enabled: true,
title: "📝 Wrong argument type",
bottomText: "This command requires a different type of argument",
accentColor: "#ff0000",
showTimestamp: true,
footer: botName,
};
this.deleteTimeout = Infinity;
}
@@ -153,6 +176,7 @@ export class SystemMessageManager {
}
}
break;
//TODO Add argument error processing
}
}
if (channel) {