mirror of
https://github.com/pieartsy/PluralFlux.git
synced 2026-04-16 17:45:28 +10:00
added enum to help messages and checks whether command is in list for member helper
This commit is contained in:
3
enums.js
3
enums.js
@@ -8,7 +8,8 @@ helperEnums.err = {
|
|||||||
MEMBER_EXISTS: "A member with that name already exists. Please pick a unique name.",
|
MEMBER_EXISTS: "A member with that name already exists. Please pick a unique name.",
|
||||||
USER_NO_MEMBERS: "You have no members created.",
|
USER_NO_MEMBERS: "You have no members created.",
|
||||||
DISPLAY_NAME_TOO_LONG: "The display name is too long. Please limit it to 32 characters or less.",
|
DISPLAY_NAME_TOO_LONG: "The display name is too long. Please limit it to 32 characters or less.",
|
||||||
PROXY_EXISTS: "A duplicate proxy already exists for one of your members. Please pick a new one, or change the old one first."
|
PROXY_EXISTS: "A duplicate proxy already exists for one of your members. Please pick a new one, or change the old one first.",
|
||||||
|
NO_SUCH_COMMAND: "No such command exists."
|
||||||
}
|
}
|
||||||
|
|
||||||
helperEnums.help = {
|
helperEnums.help = {
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import {enums} from "../enums.js";
|
|||||||
|
|
||||||
const mh = {};
|
const mh = {};
|
||||||
|
|
||||||
|
const commandList = ['--help', 'add', 'remove', 'displayName', 'proxy'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses through the subcommands that come after "pf;member" and calls functions accordingly.
|
* Parses through the subcommands that come after "pf;member" and calls functions accordingly.
|
||||||
*
|
*
|
||||||
@@ -12,6 +14,9 @@ const mh = {};
|
|||||||
*/
|
*/
|
||||||
mh.parseMemberCommand = async function(authorId, args){
|
mh.parseMemberCommand = async function(authorId, args){
|
||||||
console.log(authorId, args);
|
console.log(authorId, args);
|
||||||
|
if(!commandList.includes(args[0])) {
|
||||||
|
return enums.err.NO_SUCH_COMMAND;
|
||||||
|
}
|
||||||
switch(args[0]) {
|
switch(args[0]) {
|
||||||
case '--help':
|
case '--help':
|
||||||
return enums.help.MEMBER;
|
return enums.help.MEMBER;
|
||||||
|
|||||||
Reference in New Issue
Block a user