From c5454a8f57ff1f9e8c857ed3c15493983dbf5acb Mon Sep 17 00:00:00 2001 From: Jiiks Date: Mon, 31 Oct 2016 17:36:03 +0200 Subject: [PATCH] v2 initial slow track --- v2/README.MD | 1 + v2/lib/config.json | 8 ++++++ v2/lib/core.js | 38 +++++++++++++++++++++++++++ v2/lib/main.js | 1 + v2/lib/utils.js | 65 ++++++++++++++++++++++++++++++++++++++++++++++ v2/package.json | 10 +++++++ 6 files changed, 123 insertions(+) create mode 100644 v2/README.MD create mode 100644 v2/lib/config.json create mode 100644 v2/lib/core.js create mode 100644 v2/lib/main.js create mode 100644 v2/lib/utils.js create mode 100644 v2/package.json diff --git a/v2/README.MD b/v2/README.MD new file mode 100644 index 00000000..2915345c --- /dev/null +++ b/v2/README.MD @@ -0,0 +1 @@ +v2 preview for external testers \ No newline at end of file diff --git a/v2/lib/config.json b/v2/lib/config.json new file mode 100644 index 00000000..41605e5b --- /dev/null +++ b/v2/lib/config.json @@ -0,0 +1,8 @@ +{ + "core": { + "version": "0.3.0" + }, + "Core": { + "Version": "0.3.0" + } +} \ No newline at end of file diff --git a/v2/lib/core.js b/v2/lib/core.js new file mode 100644 index 00000000..9834ad02 --- /dev/null +++ b/v2/lib/core.js @@ -0,0 +1,38 @@ +/* BetterDiscordApp Core + * Version: 2:1.0 + * Author: Jiiks | https://jiiks.net + * Date: 31/10/2016 + * Last Update: 31/10/2016 + * Github: https://github.com/Jiiks/BetterDiscordApp + * Git: https://github.com/Jiiks/BetterDiscordApp.git + * License: MIT + */ + +'use strict'; + +const + _fs = require('fs'), + _config = require('./config.json'), + {_utils} = require('./utils'), + {_logger} = require('./utils'), + {EOL} = require('os'); + +const _startDate = new Date(); + +var _cfg; + +const _defaults = {}; + +class Core { + + constructor(args) { + + } + + initConfig(args) { + + } + +} + +exports.BetterDiscord = new Core(null); \ No newline at end of file diff --git a/v2/lib/main.js b/v2/lib/main.js new file mode 100644 index 00000000..3d1b9d33 --- /dev/null +++ b/v2/lib/main.js @@ -0,0 +1 @@ +module.exports = require('./core'); \ No newline at end of file diff --git a/v2/lib/utils.js b/v2/lib/utils.js new file mode 100644 index 00000000..64d494f6 --- /dev/null +++ b/v2/lib/utils.js @@ -0,0 +1,65 @@ +/* BetterDiscordApp Utilities + * Version: 2:1.0 + * Author: Jiiks | https://jiiks.net + * Date: 31/10/2016 + * Last Update: 31/10/2016 + * Github: https://github.com/Jiiks/BetterDiscordApp + * Git: https://github.com/Jiiks/BetterDiscordApp.git + * License: MIT + */ + +'use strict'; + +class Utils { + + //Returns a datestring: [DD/MM/YYYY - HH:MM:SS] + get dateString() { + var d = new Date(); + + return `${("00" + (d.getDate() + 1)).slice(-2)}/` + + `${("00" + d.getMonth()).slice(-2)}/` + + `${d.getFullYear()} - ` + + `${("00" + d.getHours()).slice(-2)}:` + + `${("00" + d.getMinutes()).slice(-2)}:` + + `${("00" + d.getSeconds()).slice(-2)}`; + } + +} + +class Logger { + + constructor() { + this.logs = ""; + } + + log(msg, severity) { + var l = `{BD|${this.severity(severity)}}[${_utils.dateString}] >>> ${msg}`; + console.log(l); + this.logs += `${l}${EOL}`; + } + + save() { + try { + _fs.writeFileSync('logs.log', this.logs); + }catch(err) { + this.log("Failed to save logs! " + err, 2); + } + } + + severity(severity) { + return { + 0: "INF", + 1: "WRN", + 2: "ERR" + }[severity||0]; + } + +} + +const _utils = new Utils(), + _logger = new Logger(), + _fs = require('fs'), + {EOL} = require('os'); + +exports._utils = _utils; +exports._logger = _logger; \ No newline at end of file diff --git a/v2/package.json b/v2/package.json new file mode 100644 index 00000000..e8c900da --- /dev/null +++ b/v2/package.json @@ -0,0 +1,10 @@ +{ + "name": "betterdiscord", + "description": "Discord enhancement project. v2 preview", + "version": "0.3.0", + "homepage": "https://github.com/Jiiks/BetterDiscordApp", + "license": "MIT", + "main": "lib/main.js", + "devDependencies": { + } +}