diff --git a/.gitignore b/.gitignore index 0f38482..ae6b3c6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,4 @@ node_modules/ package-lock.json config/config.json -utils/ -modules/consoleHelper/config.json +utils/ \ No newline at end of file diff --git a/modules/consoleHelper.js b/modules/consoleHelper.js index 1a8ddcf..c46a1a7 100644 --- a/modules/consoleHelper.js +++ b/modules/consoleHelper.js @@ -1,24 +1,10 @@ -const chalk = require("chalk"), -fs = require("fs"); +const chalk = require("chalk"); // Defines the function of this module const MODULE_FUNCTION = "handle_console", // Base path for module folder creation and navigation -BASE_PATH = "/consoleHelper"; - -// Only ran on startup so using sync functions is fine -// Makes the folders for files of the module -if (!fs.existsSync(__dirname + BASE_PATH)) { - fs.mkdirSync(__dirname + BASE_PATH); - console.log(`[consoleHelper] Made consoleHelper module folder`); -} -if (!fs.existsSync(__dirname + BASE_PATH + "/config.json")) { - fs.writeFileSync(__dirname + BASE_PATH + "/config.json", JSON.stringify({"24hour":true})); - console.log(`[consoleHelper] Made consoleHelper config file`); -} - -const config = require(__dirname + BASE_PATH + "/config.json"); +BASE_PATH = null; module.exports = { printInfo:function(emoji, s) { @@ -35,25 +21,7 @@ module.exports = { getTime24:function() { const time = new Date(); - if (config["24hour"]) { - return `${correctValue(time.getHours())}:${correctValue(time.getMinutes())}:${correctValue(time.getSeconds())}`; - } else { - return this.t2412(`${correctValue(time.getHours())}:${correctValue(time.getMinutes())}:${correctValue(time.getSeconds())}`); - } - }, - - t2412:function(inp) { - if (parseInt(inp.split(":")[0]) > 11) { - const i = inp.split(":"); - let i1 = parseInt(i[0]) - 12; - if (i1 == 0) i1 = 12; - return i1 + ":" + i[1] + " PM"; - } else { - const i = inp.split(":"); - let i1 = parseInt(i[0]); - if (i1 == 0) i1 = 12; - return i1 + ":" + i[1] + " AM"; - } + return `${correctValue(time.getHours())}:${correctValue(time.getMinutes())}:${correctValue(time.getSeconds())}` } } diff --git a/modules/example_request_handler.js b/modules/example_request_handler.js index c9e7129..148e8ef 100644 --- a/modules/example_request_handler.js +++ b/modules/example_request_handler.js @@ -11,9 +11,11 @@ BASE_PATH = "/example_request_handler"; // Makes the folders for files of the module if (!fs.existsSync(__dirname + BASE_PATH)) { fs.mkdirSync(__dirname + BASE_PATH); + console.log(`[example_request_handler] Made example_request_handler module folder`); } if (!fs.existsSync(__dirname + BASE_PATH + "/files")) { fs.mkdirSync(__dirname + BASE_PATH + "/files"); + console.log(`[example_request_handler] Made example_request_handler module files folder`); } module.exports = {