From 9a00e09b9d1ee53624640e6a6fcd17bced7db66e Mon Sep 17 00:00:00 2001 From: Frostbide <129122542+Frostbide@users.noreply.github.com> Date: Fri, 25 Apr 2025 12:03:13 -0700 Subject: [PATCH] Move to data folder --- .gitignore | 1 - package.json | 2 +- src/data/.gitkeep | 0 src/data/logs/.gitkeep | 0 src/plugins/database.js | 2 +- src/plugins/logging.js | 5 +++-- 6 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 src/data/.gitkeep create mode 100644 src/data/logs/.gitkeep 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) {