Imagine a package, where you can recover your local aoi.js database, this is our function, with this package, you can recover your corrupted or no longer defined database
First, just get the main folder from your database Second, delete your old database and start Third, after starting, aoi.js will create a new database, that's all we need Fourth, place the old folder called main in the new database
Usage example:
const { AoiClient } = require("aoi.js");
const { DatabaseBackup } = require("aoi.db-fixer");
const client = new AoiClient({
token: "Discord Bot Token",
prefix: "!",
intents: ["MessageContent", "Guilds", "GuildMessages"],
events: ["onMessage", "onInteractionCreate"],
database: {
type: "aoi.db",
db: require("@aoijs/aoi.db"),
dbType: "KeyValue",
tables: ["main"],
securityKey: "a-32-characters-long-string-here"
}
});
const dbBackup = new DatabaseBackup(client, {
pathTo: "path", // path to your database
table: "main" // only adjust if necessary
}); // everything ok to start
Aoi.js credits to leref