1.3.2 • Published 3 years ago

orion.system v1.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Discord Backup System

By: ArviX#8443

Created for 0rion Project.

Installation

npm install discord-backup-system

Dev Note:

  • I changed the file type to axbs1. To make the transition easier for you, I made some functions: isBackupFile and makeBackupFileCompatible.
  • Added custom backup names!

Usage

Create a Backup

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

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

Usage

ParamsTypeExplicationDefault
guildGuildGuild To BackupNone
authorIdSnowflakeAuthor of the backupNone
pathStringPath to save the backup/backup/
nameStringBackup Name (#{GEN}# to generated a random string and #{GEN_SHORT}# to generate a shorter strings)Generated

Result

ParamsTypeExplication
idStringBackup Id
pathStringBackup Path (Path/backup_id.json)

Backup Info

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

// ... 
// Your Message Event / Command
backup.backupInfo(backup_id, '/backup/').then(backupData => {
    message.channel.send(`Backup Size: ${Math.floor(backupData.size)} MB`)
});

Usage

Usage ParamsTypeExplicationDefault
backup_idStringBackup Id to give infoNone
pathStringPath/backup/

Result

Result ParamsTypeExplication
sizeNumberSize in MB
backup_idStringBackup Id
createdAtNumberCreation timestamp
guild_base_idSnowflakeBackup guild id
owner_idSnowflakeBackup Guild owner id
author_idSnowflakeBackup creator id
existsBoolReturn if file exists (If Not only exists will be in results)

Raw Backup Info

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

// ... 
// Your Message Event / Command
backup.getBackupRAW(backup_id, message.guild, '/backup/');

Usage

Usage ParamsTypeExplicationDefault
backup_idStringBackup Id to give infoNone
pathStringPath/backup/

Result

Result ParamsTypeExplication
backup_idStringBackup Id
pathStringBackup file path
backupObjectBackup file content
existsBoolReturn if file exists (If Not only exists will be in results)

Get All Backups

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

// ... 
// Your Message Event / Command
backup.getAllBackups(backup_id, message.guild, '/backup/');

Usage

Usage ParamsTypeExplicationDefault
pathStringPath/backup/

Result

Result ParamsTypeExplication
backupsArrayArray of backups infos (Same as backupInfo)
time_elapsedNumberBackup file path
fetchedNumberTotal of backup files fetched

Backup Delete

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

// ... 
// Your Message Event / Command
backup.deleteBackup(backup_id, "/backup/");

Usage

Usage ParamsTypeExplicationDefault
backup_idStringBackup IdNone
pathStringPath/backup/

Result

Result ParamsTypeExplication
deletedBoolDeleted or not
backup_idStringBackup Id
existsBoolReturn if file exists (If Not only exists will be in results)

Load Backup

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

// ... 
// Your Message Event / Command
backup.loadBackup(backup_id, message.guild, '/backup/');

Usage

Usage ParamsTypeExplicationDefault
backup_idStringBackup IdNone
guildGuildGuild to load backupNone
pathStringPath/backup/
debugBoolDebug Modefalse

Result

Result ParamsTypeExplication
backup_idStringBackup Id
reversed_rolesCollectionRoles Equivalent
reversed_channelsCollectionChannels Equivalent
bansArrayAll Bans
existsBoolReturn if file exists (If Not only exists will be in results)

Is A Backup File?

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

// ... 
// Your Message Event / Command
backup.isBackupFile(backup_id, '/backup/', true);

Usage

Usage ParamsTypeExplicationDefault
backup_idStringBackup IdNone
pathStringPath/backup/
makeItCompatibleBoolIf the backup is compatible, it will create a valid backup file (.axbs1)false

Result

Result ParamsTypeExplication
isBackupFileBoolIf the file is a valid backup file (.axbs1)
isCompatibleBoolIf the file is compatible to reformating
isReformatedBoolIf the file was reformated
existsBoolReturn if file exists (If Not only exists will be in results)

Make Backup File Compatible

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

// ... 
// Your Message Event / Command
backup.makeBackupFileCompatible(backup_id, '/backup/', true);

Usage

Usage ParamsTypeExplicationDefault
backup_idStringBackup IdNone
pathStringPath/backup/
deleteOldBoolIf the backup is compatible, it will create a valid backup file (.axbs1)true

Result

Result ParamsTypeExplication
reformatedBoolIs the file was reformated
deletedOldBoolIf the old backup file was deleted
existsBoolReturn if file exists (If Not only exists will be in results)