Fix help and about commands (this commit also adds a beta hash function)

This commit is contained in:
7cc5c4f330d47060 2024-07-22 15:01:52 -04:00
parent ee6b2b28df
commit 802b5e2971
3 changed files with 16 additions and 8 deletions

View file

@ -1,5 +1,6 @@
const fs=require("fs");
const Command=require("../util/Command.js");
const hashcheck=require("../util/hashcheck.js");
const settings = require("../settings.json");
let cmds=Object.create(null);
module.exports={
@ -16,9 +17,10 @@ module.exports={
return;
}
const cmd=text.split(" ");
let verify=hashcheck(cmd);
if(cmds[cmd[0].toLowerCase()]){
try{
cmds[cmd[0].toLowerCase()].execute(new Command(uuid,name,"nick N/A",text,prefix,b,false))
cmds[cmd[0].toLowerCase()].execute(new Command(uuid,name,"nick N/A",text,prefix,b,verify))
} catch(e) { console.log(e); b.chat("An error occured (check console for more info)") }
}
}
@ -28,10 +30,10 @@ module.exports={
if(cmds[i].hidden) continue;
helpCmds.push(prefix+i)
}
b.tellraw(uuid,JSON.stringify({"text":"Commands: "+helpCmds.join(" ")}));
b.tellraw(uuid,{"text":"Commands: "+helpCmds.join(" ")});
}
b.printCmdHelp=(uuid,cmd)=>{
b.tellraw(uuid,JSON.stringify({"text":cmd+cmds[cmd].usage+" - "+cmds[cmd].desc}));
b.tellraw(uuid,{"text":cmd+cmds[cmd].usage+" - "+cmds[cmd].desc});
}
},
loadCMD:()=>{

View file

@ -4,11 +4,11 @@ const version = require("../../version.json")
const settings = require('../../settings.json')
module.exports = {
execute: function (c) {
c.reply('{"text":"'+settings.name+' - a minecraft bot made by 77c8f4699b732c11 / a5a06d596f15c7db"}');
c.reply('{"text":""}');
c.reply('{"text":"Version '+version.bot+'"}');
c.reply('{"text":""}');
c.reply('{"text":"To view system information, run the command \\"serverinfo\\"."}')
c.reply({"text":"'+settings.name+' - a minecraft bot made by 77c8f4699b732c11 / a5a06d596f15c7db"});
c.reply({"text":""});
c.reply({"text":"Version '+version.bot+'"});
c.reply({"text":""});
c.reply({"text":"To view system information, run the command \"serverinfo\"."})
},
desc: 'About the bot',
usage: '',

6
util/hashcheck.js Normal file
View file

@ -0,0 +1,6 @@
module.exports = function (cmd) {
if(true){
return 1;
}
return 0;
}