Archived
removing unused params
This commit is contained in:
1 parent
67a3f07a71
commit
b1037edea1
1 file changed
+13
-1
+13
-1
@@ -194,6 +194,7 @@ export class CommandManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchFromInteraction(
|
fetchFromInteraction(
|
||||||
interaction: CommandInteraction
|
interaction: CommandInteraction
|
||||||
): CommandMessageStructure | null {
|
): CommandMessageStructure | null {
|
||||||
@@ -218,8 +219,17 @@ export class CommandManager {
|
|||||||
}
|
}
|
||||||
const parameters: InputParameter[] = [];
|
const parameters: InputParameter[] = [];
|
||||||
cmd.parameters.map((p, i) => {
|
cmd.parameters.map((p, i) => {
|
||||||
if (!p.optional && !paramsList[i]) {
|
const inputParam = paramsList[i];
|
||||||
|
if (!p.optional && !inputParam) {
|
||||||
throw new MissingParameterError(p);
|
throw new MissingParameterError(p);
|
||||||
|
} else if (
|
||||||
|
p.optional &&
|
||||||
|
(!inputParam ||
|
||||||
|
inputParam == "" ||
|
||||||
|
inputParam == "_" ||
|
||||||
|
inputParam == " ")
|
||||||
|
) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
switch (p.type) {
|
switch (p.type) {
|
||||||
case "string":
|
case "string":
|
||||||
@@ -255,6 +265,8 @@ export class CommandManager {
|
|||||||
const inputParam = paramsList.find((d) => d.name == p.name);
|
const inputParam = paramsList.find((d) => d.name == p.name);
|
||||||
if (!p.optional && !inputParam) {
|
if (!p.optional && !inputParam) {
|
||||||
throw new MissingParameterError(p);
|
throw new MissingParameterError(p);
|
||||||
|
} else if (p.optional && !inputParam) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
switch (p.type) {
|
switch (p.type) {
|
||||||
case "string":
|
case "string":
|
||||||
|
|||||||
Reference in new issue
Block a user