Giter Club home page Giter Club logo

discord-backup-system's Introduction

Discord Backup System

By: ArviX#8443

Created for 0rion Project.

Installation

npm install discord-backup-system

Patch Note:

  • Backup files are now axbs2 format. The system will automatically convert axbs1 to axbs2 format if you were using an older version of the system.
  • The backup system is now a class. It will be needed to be initialized first.
  • You can now choose the order of the loading of the backup. I recommend you to use the default order.
  • The Backup ID is still editable.

Usage

Create a Backup

const BackupSystem = require('discord-backup-system');

client.BackupSystem = new BackupSystem("/backups/");
// ... 
// Your Message Event / Command
client.BackupSystem.create(message.guild, message.author.id, `${message.guild.id}-#{GEN_SHORT}#`).then(backupData => {
    message.channel.send(`This is your backup: \`${backupData.id}\``)
});

Usage

Params Type Explication Default
guild Guild Guild To Backup None
authorId Snowflake Author of the backup None
name String Backup Name (#{GEN}# to generated a random string and #{GEN_SHORT}# to generate a shorter strings) Generated

Result

Params Type Explication
id String Backup Id
path String Backup Path (Path/backup_id.axbs2)
backup Backup Backup Data

Backup Info

const BackupSystem = require('discord-backup-system');

client.BackupSystem = new BackupSystem("/backups/");
// ... 
// Your Message Event / Command
client.BackupSystem.getBackupInfo(backup_id).then(backupData => {
    message.channel.send(`Backup Size: ${Math.floor(backupData.size)} MB`)
});

Usage

Usage Params Type Explication Default
backup_id String Backup Id to give info None

Result

Result Params Type Explication
size Number Size in MB
backup_id String Backup Id
createdAt Number Creation timestamp
authorId String The Creator of the backup ID
Guild { id: string; owner_id: string } The guild data
exists Bool Return if file exists ( If Not, only exists param will be returned )

Get All Backups

/* NOT IMPLEMENTED YET */
const BackupSystem = require('discord-backup-system');

client.BackupSystem = new BackupSystem("/backups/");
// ... 
// Your Message Event / Command
client.BackupSystem.getAllBackups(backup_id, message.guild, '/backup/');

Usage

Usage Params Type Explication Default

Result

Result Params Type Explication

Backup Delete

const BackupSystem = require('discord-backup-system');

client.BackupSystem = new BackupSystem("/backups/");
// ... 
// Your Message Event / Command
client.BackupSystem.deleteBackup(backup_id);

Usage

Usage Params Type Explication Default
backup_id String Backup Id None

Result

Result Params Type Explication
backup_id String Backup Id
deleted Bool Deleted or not
exists Bool Return if file exists (If Not, only exists param will be in returned)

Load Backup

const BackupSystem = require('discord-backup-system');

client.BackupSystem = new BackupSystem("/backups/");
// ... 
// Your Message Event / Command
client.BackupSystem.load(backup_id, message.guild);

Usage

Usage Params Type Explication Default
backup_id String Backup Id None
guild Guild Guild to load backup None
order String Order of loading channels_roles&create_emojis&delete_emojis&bans&guild

Result

Result Params Type Explication
Backup Backup Backup Data

Is A Backup File?

const BackupSystem = require('discord-backup-system');

client.BackupSystem = new BackupSystem("/backups/");
// ... 
// Your Message Event / Command
client.BackupSystem.isBackupFile(backup_id);

Usage

Usage Params Type Explication Default
backup_id String Backup Id None

Result

Result Params Type Explication
isValidBackupFile Bool Is Valid Backup File
isOldTimer Bool Is Old Timer (axbs1 format)
version Number / Null Version of the backup
convertible Bool Is the file convertible to axbs2

Make Backup File Compatible

const BackupSystem = require('discord-backup-system');

client.BackupSystem = new BackupSystem("/backups/");
// ... 
// Your Message Event / Command
client.BackupSystem.convertBackup(backup_id);

Usage

Usage Params Type Explication Default
backup_id String Backup Id None

Result

Result Params Type Explication
id String Backup Id
path String Backup Path (Path/backup_id.axbs2)
backup Backup Backup Data

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.