added dynamic database & everything is now v2.0.0
Changed everything from v1.4.0 to v2.0.0 & added the dynamic database system
This commit is contained in:
@@ -24,7 +24,7 @@ ask()
|
||||
const runClear = async () => {
|
||||
const chalk = await (await import("chalk")).default
|
||||
console.log(chalk.blue("You can get a node.js warning below, just ignore that, it's not important!"))
|
||||
const dataPaths = ["./storage/tickets","./storage/transcripts","./storage/userTickets"]
|
||||
const dataPaths = ["./storage/dynamicDB"]
|
||||
|
||||
var index = 0
|
||||
|
||||
@@ -32,20 +32,20 @@ const runClear = async () => {
|
||||
try {
|
||||
fs.rmdirSync(path,{recursive:true,force:true})
|
||||
}catch{
|
||||
console.log(path,"doesn't exist")
|
||||
//console.log(path,"doesn't exist")
|
||||
}
|
||||
setTimeout(() => {
|
||||
try{
|
||||
fs.mkdirSync(path)
|
||||
}catch{
|
||||
console.log(path,"already exists")
|
||||
//console.log(path,"already exists")
|
||||
}
|
||||
index++
|
||||
},500)
|
||||
})
|
||||
|
||||
setInterval(() => {
|
||||
if (index >= 3){
|
||||
if (index >= 1){
|
||||
console.log(chalk.bgGreen("All local data is cleared!"))
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
const localstorage = require("node-localstorage")
|
||||
|
||||
const ls = new localstorage.LocalStorage("./storage/dynamicDB")
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} category
|
||||
* @param {String} id
|
||||
* @param {String} value
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
exports.set = (category,id,value) => {
|
||||
ls.setItem(category+"--"+id,value.toString())
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} category
|
||||
* @param {String} id
|
||||
* @returns {String|false}
|
||||
*/
|
||||
exports.get = (category,id) => {
|
||||
const result = ls.getItem(category+"--"+id)
|
||||
if (!result) return false
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} category
|
||||
* @param {String} id
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
exports.delete = (category,id) => {
|
||||
ls.removeItem(category+"--"+id)
|
||||
return true
|
||||
}
|
||||
@@ -1,3 +1,18 @@
|
||||
//Do not change this without knowing what you are doing!!
|
||||
const databaseFile = "local"
|
||||
//Do not change this without knowing what you are doing!!
|
||||
|
||||
|
||||
try {
|
||||
var db = require("./dynamicfiles/local")
|
||||
}catch{
|
||||
console.log("I couldn't find the database file! (location: ./core/dynamicdatabase/storage.js:2)")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
module.exports = db
|
||||
|
||||
|
||||
/** =============================
|
||||
** NOT READY YET
|
||||
** must be dynamic
|
||||
|
||||
Reference in New Issue
Block a user