Add command aliases + several bug fixes
This commit is contained in:
parent
b6d0c06e7b
commit
037181d2e0
5 changed files with 20 additions and 10 deletions
plugins
|
@ -31,7 +31,7 @@ module.exports={
|
|||
b.tellraw(uuid,JSON.stringify({"text":"Commands: "+helpCmds.join(" ")}));
|
||||
}
|
||||
b.printCmdHelp=(uuid,cmd)=>{
|
||||
b.tellraw(uuid,JSON.stringify({"text":"Commands: "+cmd+cmds[cmd].usage+" - "+cmds[cmd].desc}));
|
||||
b.tellraw(uuid,JSON.stringify({"text":cmd+cmds[cmd].usage+" - "+cmds[cmd].desc}));
|
||||
}
|
||||
},
|
||||
loadCMD:()=>{
|
||||
|
@ -42,8 +42,20 @@ module.exports={
|
|||
continue
|
||||
}
|
||||
try {
|
||||
cmds[bpl[i].split(".js")[0]]=require(`./commands/${bpl[i]}`);
|
||||
console.log("Loaded command "+bpl[i].split(".js")[0])
|
||||
commandName=bpl[i].split(".js")[0];
|
||||
cmds[commandName]=require(`./commands/${bpl[i]}`);
|
||||
console.log("Loaded command "+commandName)
|
||||
if(cmds[commandName].aliases){
|
||||
for(const j in cmds[commandName].aliases){
|
||||
cmds[cmds[commandName].aliases[j]]={
|
||||
execute:cmds[commandName].execute,
|
||||
desc:"Alias to "+commandName,
|
||||
usage:cmds[commandName].usage,
|
||||
hidden:true,
|
||||
consoleIndex:cmds[commandName].consoleIndex
|
||||
};
|
||||
}
|
||||
}
|
||||
} catch (e) { console.log(e); }
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@ module.exports={
|
|||
if(c.args.length>0){
|
||||
c.bot.printCmdHelp(c.uuid,c.args[0]);
|
||||
} else {
|
||||
c.bot.printHelp(c.uuid);
|
||||
c.bot.printHelp(c.args[0]);
|
||||
}
|
||||
},
|
||||
desc: "Shows command help",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module.exports={
|
||||
execute: (c)=>{
|
||||
if(c.type!=console) return;
|
||||
if(c.type!="console") return;
|
||||
c.bot._client.end();
|
||||
},
|
||||
desc: "Does nothing", // Command description
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
module.exports={
|
||||
execute: (c)=>{
|
||||
if(c.type!=console) return;
|
||||
if(c.type!="console") return;
|
||||
process.exit(0);
|
||||
},
|
||||
desc: "Restart bot", // Command description
|
||||
usage: ' <required> [optional]', // Command usage
|
||||
hidden: true
|
||||
hidden: true,
|
||||
aliases: ["restart"]
|
||||
}
|
||||
|
|
|
@ -14,14 +14,11 @@ module.exports = {
|
|||
prompt: '\x1b[0m\x1b[38;5;15m> '
|
||||
})
|
||||
rl.on('line', (l) => {
|
||||
// 00000000-0000-0000-0000-Console00000
|
||||
try {
|
||||
if(newercommands[l.split(' ')[0].toLowerCase()]){
|
||||
if(newercommands[l.split(' ')[0].toLowerCase()].consoleIndex){
|
||||
let tmpcmd = l.split(' ');
|
||||
const index2 = tmpcmd.splice(1,1)[0];
|
||||
|
||||
|
||||
if (index2 === '*') {
|
||||
for (let i = 0; i < index.bot.length; i++) {
|
||||
//if(index.bot[i].o.disabled) continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue