-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use custom database to store backups #148
Comments
This is good idea to add it |
Hello 👋 const Discord = require('discord.js');
const client = new Discord.Client();
const backup = require('discord-backup');
const quickdb = require('quick.db');
client.login('your bot token');
const prefix = '!';
client.on('message', async (message) => {
const args = message.content.slice(prefix).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if (command === '!backup') {
const guildData = backup.create(message.guild, {
jsonSave: false // so the backup won't be saved to a json file
});
// guildData is a variable that contains all your backup data!
// You can store it wherever you want
// for example, in quick.db
quickdb.set(`backup_${guildData.id}`, guildData); // for example with quick.db
}
if (command === '!load') {
const backupID = args.join(' ');
// Retrieve backup data from quick.db
const backupData = quickdb.get(`backup_${backupID}`);
// and load the backup!
backup.load(backupData, message.guild);
}
}); Hope this helps 😉 |
Androz2091
changed the title
How can I use the a custom Database to store backups?
Use custom database to store backups
Jan 2, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The title itself is self explanatory, how can I use something like quick.db to store the backups instead of json as a database?
The text was updated successfully, but these errors were encountered: