npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@betsbest/discord-backup

v1.1.0

Published

A module for backing up and restoring discord servers.

Downloads

207

Readme

@betsbest/discord-backup

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. I'm not the author of all this, credit goes to Outwalk, I just fixed some errors


Installation

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

npm install @betsbest/discord-backup

Create

Create a backup for the specified server.

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

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

Load

Allows you to load a backup on a Discord server!

import backup from "@betsbest/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 "@betsbest/discord-backup";

const backupInfo = await backup.fetch(backupId);

Remove

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

import backup from "@betsbest/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 "@betsbest/discord-backup";

const backups = backup.list();

SetStorageFolder

Updates the storage folder to another

import backup from "@betsbest/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 "@betsbest/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,
    ignore2FA: false
});

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. ignore2FA: Disables attempting to grab items that require 2FA

Requires 2FA

  • Auto Moderation Rules
  • Bans

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 "@betsbest/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.


License

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