Archived
added parameters to help command + changed type names to more user-friendly
This commit is contained in:
1 parent
6447759caf
commit
8e3c3afc6d
2 files changed
+12
-12
No files matched your search
+8
-1
@@ -21,7 +21,14 @@ export class HelpMessage extends Command {
|
||||
usage: params.usage,
|
||||
permissions: 0,
|
||||
description: params.description,
|
||||
function: (m, a) => {
|
||||
parameters: [
|
||||
{
|
||||
name: "Command name",
|
||||
optional: true,
|
||||
type: "TEXT",
|
||||
},
|
||||
],
|
||||
function: (_, a) => {
|
||||
const helpMsg = new MessageEmbed();
|
||||
helpMsg.setColor(params.color);
|
||||
helpMsg.setTimestamp();
|
||||
|
||||
+4
-11
@@ -1,6 +1,6 @@
|
||||
import { ParameterTypeError } from "./Error.js";
|
||||
|
||||
export type ParameterType = "STRING" | "BOOLEAN" | "INTEGER" | "FLOAT";
|
||||
export type ParameterType = "TEXT" | "TRUE/FALSE" | "NUMBER";
|
||||
export type ParameterResolvable = string | boolean | number;
|
||||
export interface Parameter {
|
||||
name: string;
|
||||
@@ -12,23 +12,16 @@ export const ProcessArgument = (
|
||||
type: ParameterType
|
||||
): ParameterResolvable => {
|
||||
switch (type) {
|
||||
case "STRING":
|
||||
case "TEXT":
|
||||
return a;
|
||||
case "INTEGER":
|
||||
const numI = parseInt(a);
|
||||
if (isNaN(numI)) {
|
||||
throw new ParameterTypeError(a, type);
|
||||
} else {
|
||||
return numI;
|
||||
}
|
||||
case "FLOAT":
|
||||
case "NUMBER":
|
||||
const numF = parseFloat(a);
|
||||
if (isNaN(numF)) {
|
||||
throw new ParameterTypeError(a, type);
|
||||
} else {
|
||||
return numF;
|
||||
}
|
||||
case "BOOLEAN":
|
||||
case "TRUE/FALSE":
|
||||
if (a.toLowerCase() == "true") {
|
||||
return true;
|
||||
} else if (a.toLowerCase() == "false") {
|
||||
|
||||
Reference in new issue
Block a user