Archived
ProcessPhrase is now a static method of the "Command" class
This commit is contained in:
1 parent
ba56d41c73
commit
261634e213
1 file changed
+18
-20
+18
-20
@@ -39,8 +39,8 @@ class Command {
|
||||
|
||||
constructor(options: CommandBuilder) {
|
||||
this.name = options.name.split(' ').join('_');
|
||||
this.aliases = ProcessPhrase(options.aliases);
|
||||
this.keywords = ProcessPhrase(options.keywords);
|
||||
this.aliases = Command.ProcessPhrase(options.aliases);
|
||||
this.keywords = Command.ProcessPhrase(options.keywords);
|
||||
this.description = options.description || "No description";
|
||||
this.usage = options.usage || "";
|
||||
this.permissions = new Permissions(options.permissions || 0);
|
||||
@@ -56,6 +56,22 @@ class Command {
|
||||
throw new PermissionsError(this, message?.member);
|
||||
}
|
||||
}
|
||||
static ProcessPhrase(phrase?: string | string[]) : string[] {
|
||||
if(Array.isArray(phrase)) {
|
||||
const buff = phrase.map((p) => {
|
||||
return p.split(' ').join('_');
|
||||
});
|
||||
return buff;
|
||||
}
|
||||
else if(typeof phrase == 'string') {
|
||||
const buff = [];
|
||||
buff.push(phrase.split(' ').join('_'));
|
||||
return buff;
|
||||
}
|
||||
else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
class CommandsManager {
|
||||
list: Command[];
|
||||
@@ -103,23 +119,5 @@ class CommandsManager {
|
||||
}
|
||||
}
|
||||
|
||||
//FUNCTIONS
|
||||
const ProcessPhrase = (phrase?: string | string[]) : string[] => {
|
||||
if(Array.isArray(phrase)) {
|
||||
const buff = phrase.map((p) => {
|
||||
return p.split(' ').join('_');
|
||||
});
|
||||
return buff;
|
||||
}
|
||||
else if(typeof phrase == 'string') {
|
||||
const buff = [];
|
||||
buff.push(phrase.split(' ').join('_'));
|
||||
return buff;
|
||||
}
|
||||
else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
//EXPORTS
|
||||
export { Command, CommandsManager }
|
||||
Reference in new issue
Block a user