Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 5 Examples of "discord-backup in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'discord-backup' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

return message.channel.send(message.language.get("BACKUP_ERR_STATUS"));
        }

        if(status === "create"){
            backup.create(message.guild).then((backupID) => {
                message.channel.send(message.language.get("BACKUP_CREATE_SUCCESS"));
                message.author.send(message.language.get("BACKUP_CREATE_SUCCESS_ID", backupID))
            }).catch((err) => {
                return message.channel.send(message.language.get("ERR_OCCURENCED"));
            });
        } else if (status === "load"){
            let backupID = args[1];
            if(!backupID){
                return message.channel.send(message.language.get("BACKUP_ERR_ID"));
            }
            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"));
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
                return message.channel.send(message.language.get("BACKUP_ERR_NOT_FOUND", backupID));
            });
        } else if (status === "infos"){
            let backupID = args[1];
            if(!backupID){
                return message.channel.send(message.language.get("BACKUP_ERR_ID"));
            }
            backup.fetch(backupID).then(async (backupInfos) => {
                let embed = new Discord.MessageEmbed()
                    .setAuthor(message.language.get("BACKUP_HEADINGS")[0])
                    // Display the backup ID
                    .addField(message.language.get("BACKUP_HEADINGS")[1], backupInfos.ID, true)
                    // Displays the server from which this backup comes
                    .addField(message.language.get("BACKUP_HEADINGS")[2], backupInfos.guildID, true)
                    // Display the size (in mb) of the backup
                    .addField(message.language.get("BACKUP_HEADINGS")[3], backupInfos.size, true)
                    // Display when the backup was created
                    .addField(message.language.get("BACKUP_HEADINGS")[4], message.language.printDate(new Date(backupInfos.createdTimestamp)), true)
                    .setColor(data.config.embed.color)
                    .setFooter(data.config.embed.footer);
                message.channel.send(embed);
            }).catch((err) => {
                // if the backup wasn't found
                return message.channel.send(message.language.get("BACKUP_ERR_NOT_FOUND", backupID));
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
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
async run (message, args, data) {

        let status = args[0];
        if(!status){
            return message.channel.send(message.language.get("BACKUP_ERR_STATUS"));
        }

        if(status === "create"){
            backup.create(message.guild).then((backupID) => {
                message.channel.send(message.language.get("BACKUP_CREATE_SUCCESS"));
                message.author.send(message.language.get("BACKUP_CREATE_SUCCESS_ID", backupID))
            }).catch((err) => {
                return message.channel.send(message.language.get("ERR_OCCURENCED"));
            });
        } else if (status === "load"){
            let backupID = args[1];
            if(!backupID){
                return message.channel.send(message.language.get("BACKUP_ERR_ID"));
            }
            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"]

Is your System Free of Underlying Vulnerabilities?
Find Out Now