diff --git a/bot.js b/bot.js new file mode 100644 index 0000000..e69de29 diff --git a/src/db/connect.js b/src/db/connect.js new file mode 100644 index 0000000..6637e73 --- /dev/null +++ b/src/db/connect.js @@ -0,0 +1,10 @@ +module.exports = async client => { + const config = client.config; + try { + await mongoose.connect(`mongodb+srv://${config.database.user}:${config.database.password}@${config.database.cluster}.3jpp4.mongodb.net/test`, { + useFindAndModify: false, useNewUrlParser: true, dbName: 'Natsuki-Main', useUnifiedTopology: true, useCreateIndex: true + }).catch(() => {}); + } catch (e) { + + } +}; \ No newline at end of file diff --git a/src/util/log/getlevel.js b/src/util/log/getlevel.js new file mode 100644 index 0000000..ea338ca --- /dev/null +++ b/src/util/log/getlevel.js @@ -0,0 +1,17 @@ +const config = require('../../json/config.json'); +const levels = require('./levels.json'); +const validStrings = Object.keys(levels); + +const getLevel = (level) => { + console.log(level) + if (typeof level === 'number') { + if (level <= 0) {return 0;} + if (level > 3) {return 3;} + return Math.floor(level); + } else { + const levelM = `${level}`.trim().toUpperCase(); + return validStrings.includes(levelM) ? levels[levelM] : typeof config.log.defaultLevel === 'number' ? getLevel(config.log.defaultLevel) : 1; + } +}; + +module.exports = getLevel; \ No newline at end of file diff --git a/src/util/log/levels.json b/src/util/log/levels.json new file mode 100644 index 0000000..4482d9a --- /dev/null +++ b/src/util/log/levels.json @@ -0,0 +1,5 @@ +{ + "TOP": 0, + "STANDARD": 1, + "VERBOSE": 2 +} \ No newline at end of file diff --git a/src/util/log/log.js b/src/util/log/log.js new file mode 100644 index 0000000..7ab5613 --- /dev/null +++ b/src/util/log/log.js @@ -0,0 +1,5 @@ + + +module.exports = (message, level, source, color) => { + +}; \ No newline at end of file diff --git a/src/util/log/types.js b/src/util/log/types.js new file mode 100644 index 0000000..e69de29