Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
backup.fetch(backupID).then(async () => {
message.channel.send(message.language.get("BACKUP_CONFIRMATION"));
await message.channel.awaitMessages(m => (m.author.id === message.author.id) && (m.content === "-confirm"), {
max: 1,
time: 20000,
errors: ["time"]
}).catch((err) => {
// if the author of the commands does not confirm the backup loading
return message.channel.send(message.language.get("BACKUP_ERR_TIMEOUT"));
});
// When the author of the command has confirmed that he wants to load the backup on his server
message.author.send(message.language.get("BACKUP_START_SAVING"));
// Load the backup
backup.load(backupID, message.guild).then(() => {
// When the backup is loaded, delete them from the server
backup.delete(backupID);
message.author.send(message.language.get("BACKUP_LOAD_SUCCESS"));
}).catch((err) => {
// If an error occurenced
return message.author.send(message.language.get("ERR_OCCURENCED"));
});
}).catch((err) => {
// if the backup wasn't found