diff --git a/.gitignore b/.gitignore index cfb827d..8f62671 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ # Logs -logs *.log npm-debug.log* yarn-debug.log* diff --git a/package.json b/package.json index cad09bb..3c97a53 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Discord utility bot", "main": "src/index.js", "scripts": { - "start": "mkdir -p src/logs && while true; do node --no-warnings src/index.js; [ $? -ne 0 ] || break; done", + "start": "mkdir -p src/data/logs && while true; do node --no-warnings src/index.js; [ $? -ne 0 ] || break; done", "dev": "DEVELOPMENT=true node --no-warnings src/index.js" }, "repository": { diff --git a/src/data/.gitkeep b/src/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/data/logs/.gitkeep b/src/data/logs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/plugins/database.js b/src/plugins/database.js index 3aa34d6..80767e2 100644 --- a/src/plugins/database.js +++ b/src/plugins/database.js @@ -1,6 +1,6 @@ const sqlite3 = require('sqlite3').verbose(); const path = require('path'); -const dbpath = path.join(__dirname, '..', 'data.db'); +const dbpath = path.join(__dirname, '..', 'data', 'data.db'); function main(ctx) { const { bot, options } = ctx; bot.database = { diff --git a/src/plugins/logging.js b/src/plugins/logging.js index 0e3b31b..2683819 100644 --- a/src/plugins/logging.js +++ b/src/plugins/logging.js @@ -2,14 +2,15 @@ const chalk = require('chalk'); const readline = require('readline'); const path = require('path'); const fs = require('fs'); +const logDir = path.join(__dirname, '..', 'data', 'logs'); function main(ctx) { const { bot, options } = ctx; bot.logger = { - logDir: path.join(__dirname, '..', 'logs'), + logDir, logPath: path.join( - path.join(__dirname, '..', 'logs'), + logDir, Math.floor(+new Date() / 1000).toString() + '.log' ), log(...args) {