Initial Code Upload

This commit is contained in:
Aiden
2021-10-28 19:53:19 +02:00
parent 71b2934c0d
commit ab5905f774
8 changed files with 2493 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
module.exports = {
name:"Startup_function",
async function(){
// Put any code here that you want to be executed on startup
// We are now calling the example function from the example folder
mapFunctions.get("example").function("Startup")
}
}
+29
View File
@@ -0,0 +1,29 @@
module.exports = {
name:"cliCommands",
async function(command, args){
switch(command){
case "exit":
process.exit(1);
break;
case "reload":
// Reloading the Function Map
var path = `${mainDir}/modules`
var folders = fs.readdirSync(path).filter(function (file) {
return fs.statSync(path+'/'+file).isDirectory();
});
folders.forEach(element => {
var commandFiles = fs.readdirSync(`${path}/${element}`).filter(file => file.endsWith('.js') && !file.startsWith("index"));
for (const file of commandFiles) {
delete require.cache[require.resolve(`${path}/${element}/${file}`)];
const command = require(`${path}/${element}/${file}`);
mapFunctions.set(command.name, command);
}
});
console.log(`Reloaded ${mapEvents.size + mapFunctions.size} modules`)
break;
default:
console.log("This is not a recognised command");
break;
};
}
}