Finished up with chat prompt autocomplete.
This commit is contained in:
parent
acbe0400c4
commit
9df7f52e9e
7 changed files with 197 additions and 100 deletions
|
|
@ -170,7 +170,9 @@ class commandPreprocessor{
|
|||
tokes: {
|
||||
prefix: '!',
|
||||
postfix: '',
|
||||
cmds: this.usedTokes
|
||||
cmds: [
|
||||
['toke', true]
|
||||
].concat(injectPerms(this.usedTokes))
|
||||
},
|
||||
//Make sure to add spaces at the end for commands that take arguments
|
||||
//Not necissary but definitely nice to have
|
||||
|
|
@ -178,50 +180,48 @@ class commandPreprocessor{
|
|||
prefix: '!',
|
||||
postfix: '',
|
||||
cmds: [
|
||||
"whisper ",
|
||||
"announce ",
|
||||
"serverannounce ",
|
||||
"clear ",
|
||||
"kick "
|
||||
["whisper ", true],
|
||||
["announce ", client.user.permMap.chan.get('announce')],
|
||||
["serverannounce ", client.user.permMap.site.get('announce')],
|
||||
["clear ", client.user.permMap.chan.get('clearChat')],
|
||||
["kick ", client.user.permMap.chan.get('kickUser')],
|
||||
]
|
||||
},
|
||||
localCMD:{
|
||||
prefix: '/',
|
||||
postfix: '',
|
||||
cmds: [
|
||||
"high "
|
||||
["high ", true]
|
||||
]
|
||||
},
|
||||
usernames:{
|
||||
prefix: '',
|
||||
postfix: '',
|
||||
cmds: Array.from(client.userList.colorMap.keys())
|
||||
cmds: injectPerms(Array.from(client.userList.colorMap.keys()))
|
||||
},
|
||||
emotes:{
|
||||
prefix:'[',
|
||||
postfix:']',
|
||||
cmds: this.getEmoteNames()
|
||||
cmds: injectPerms(this.getEmoteNames())
|
||||
}
|
||||
};
|
||||
|
||||
//Ensure default toke command
|
||||
//Check if 'toke' is the first registered toke
|
||||
if(dictionary.tokes.cmds[0] != 'toke'){
|
||||
//Find the current place of the 'toke' command, if any
|
||||
const tokeIndex = dictionary.tokes.cmds.indexOf('toke');
|
||||
|
||||
//If the default command is present but is out of order
|
||||
if(tokeIndex != -1){
|
||||
//Splice it out
|
||||
dictionary.tokes.cmds.splice(tokeIndex,1);
|
||||
}
|
||||
|
||||
//Throw it into the beggining of the array
|
||||
dictionary.tokes.cmds.unshift('toke');
|
||||
}
|
||||
};
|
||||
|
||||
//return our dictionary object
|
||||
return dictionary;
|
||||
|
||||
function injectPerms(cmds, perm = true){
|
||||
//Create empty array to hold cmds
|
||||
let cmdSet = [];
|
||||
|
||||
//For each cmd
|
||||
for(let cmd of cmds){
|
||||
//Add the cmd with its perm to the cmdset
|
||||
cmdSet.push([cmd, perm]);
|
||||
}
|
||||
|
||||
//return the cmd set
|
||||
return cmdSet;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue