Archived
guild-specific commands
This commit is contained in:
1 parent
62a4bc35c8
commit
6b2899caad
4 files changed
+137
-105
No files matched your search
@@ -1,8 +1,11 @@
|
||||
import { CommandInteraction, Message } from "discord.js";
|
||||
import { MissingParameterError } from "errors.js";
|
||||
import { Parameter } from "Parameter.js";
|
||||
import { Command } from "./Command.js";
|
||||
import {
|
||||
CommandMessageStructure,
|
||||
GetMode,
|
||||
ParameterResolvable,
|
||||
PhraseOccurrenceData,
|
||||
} from "./types.js";
|
||||
|
||||
@@ -145,6 +148,19 @@ export class CommandManager {
|
||||
) {
|
||||
paramsList.splice(0, 1);
|
||||
}
|
||||
let parameters: ParameterResolvable[] = paramsList;
|
||||
if (command.parameters) {
|
||||
command.parameters.map((a, i) => {
|
||||
if (!parameters[i] && !a.optional) {
|
||||
throw new MissingParameterError(a);
|
||||
} else if (parameters[i]) {
|
||||
parameters[i] = Parameter.processString(
|
||||
parameters[i] as string,
|
||||
a.type
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
return {
|
||||
command: command,
|
||||
parameters: paramsList,
|
||||
|
||||
Reference in new issue
Block a user