GithubHelp home page GithubHelp logo

hosfad / discord-backup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from outwalkstudios/discord-backup

0.0 0.0 0.0 219 KB

a module for backing up and restoring discord servers.

License: MIT License

JavaScript 100.00%

discord-backup's Introduction

@outwalk/discord-backup

License Follow Us

Discord Backup is a module for backing up and restoring discord servers.

This package is heavily inspired by discord-backup which has become unmaintained. This package has been updated to support discord.js v14 and aims to maintain API compatibility with discord-backup.


Installation

You can install @outwalk/discord-backup using npm:

npm install @outwalk/discord-backup

Create

Create a backup for the specified server.

import backup from "@outwalk/discord-backup";

const backupData = await backup.create(guild, options);

Load

Allows you to load a backup on a Discord server!

import backup from "@outwalk/discord-backup";

await backup.load(backupId, guild);
await backup.remove(backupId);

Fetch

Fetches information from a backup. The backup info provides a data, id, and size property.

import backup from "@outwalk/discord-backup";

const backupInfo = await backup.fetch(backupId);

Remove

Warn: once the backup is removed, it is impossible to recover it!

import backup from "@outwalk/discord-backup";

backup.remove(backupID);

List

Note: backup.list() simply returns an array of IDs, you must fetch the ID to get complete information.

import backup from "@outwalk/discord-backup";

const backups = backup.list();

SetStorageFolder

Updates the storage folder to another

import backup from "@outwalk/discord-backup";
import path from "path";

backup.setStorageFolder(path.join(process.cwd(), "backups"));

Advanced usage

Create [advanced]

You can use more options for backup creation:

import backup from "@outwalk/discord-backup";

await backup.create(guild, {
    backupId: "mybackup",
    maxMessagesPerChannel: 10,
    jsonSave: false,
    jsonBeautify: true,
    doNotBackup: ["roles", "channels", "emojis", "bans"],
    backupMembers: false,
    saveImages: "base64",
    speed: 250
});

backupId: Specify an Id to be used for the backup, if not provided a random one will be generated.
maxMessagesPerChannel: Maximum of messages to save in each channel. "0" won't save any messages.
jsonSave: Whether to save the backup into a json file. You will have to save the backup data in your own db to load it later.
jsonBeautify: Whether you want your json backup pretty formatted.
doNotBackup: Things you don't want to backup. Available items are: roles, channels, emojis, bans.
backupMembers: Wether or not to save information on the members of the server.
saveImages: How to save images like guild icon and emojis. Set to "url" by default, restoration may not work if the old server is deleted. So, url is recommended if you want to clone a server (or if you need very light backups), and base64 if you want to backup a server. Save images as base64 creates heavier backups.
speed: What speed to run at, default is 250 (measured in ms)
verbose: Derermines if the output should be verbose or not.

Load [advanced]

As you can see, you're able to load a backup from your own data instead of from an ID:

import backup from "@outwalk/discord-backup";

await backup.load(backupData, guild, {
    clearGuildBeforeRestore: true,
    maxMessagesPerChannel: 10,
    speed: 250,
    doNotLoad: ["roleAssignments", "emojis"]
});

clearGuildBeforeRestore: Whether to clear the guild (roles, channels, etc... will be deleted) before the backup restoration (recommended).
maxMessagesPerChannel: Maximum of messages to restore in each channel. "0" won't restore any messages.
speed: What speed to run at, default is 250 (measured in ms)
verbose: Determines if the output should be verbose or not.
doNotLoad: Things you dont want to restore. Available items are: main, roleAssignments, emojis. main will prevent loading the main backup, roleAssignments will prevent reassigning roles to members, and emojis will prevent restoring emojis.


Reporting Issues

If you are having trouble getting something to work or run into any problems, you can create a new issue.


License

@outwalk/discord-backup is licensed under the terms of the MIT license.

discord-backup's People

Contributors

jleeson avatar weeeqt avatar sjogrendev avatar hosfad avatar phyroks avatar scderox avatar tuskarma avatar

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.