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

@coffeebots/discord-backup

v1.0.0

Published

A complete framework to facilitate server backup using discord.js v14

Downloads

12

Readme

@coffeebots/discord-backup

@coffeebots/discord-backup is a powerful Node.js module that allows you to easily manage discord server backups!

Features

  • ⏱️ Easy to use!
  • 🔥 Unlimited backups!
  • ⏱️ Backup creation takes less than 10 seconds!
  • ✨ Even restores messages with webhooks!
  • 🚀 And restores everything that is possible to restore (channels, roles, permissions, bans, emojis, name, icon, and more!)

Installation

npm install --save @coffeebots/discord-backup

Examples

Create

Create a backup for the server specified in the parameters!

/**
 * @param {Guild} [Guild] - The discord server you want to backup
 * @param {object} [options] - The backup options
 */

const { create } = require("@coffeebots/discord-backup");
create(Guild, options).then((backupData) => {
    console.log(backupData.id); // NSJH2
});

Click here to learn more about backup options.

Load

Allows you to load a backup on a Discord server!

/**
 * @param {string} [backupID] - The ID of the backup that you want to load
 * @param {Guild} [Guild] - The discord server on which you want to load the backup
 */

const { load, remove } = require("@coffeebots/discord-backup");
load(backupID, Guild).then(() => {
    remove(backupID); // When the backup is loaded, it's recommended to delete it
});

Fetch

Fetches information from a backup

/**
 * @param {string} [backupID] - The ID of the backup to fetch
 */

const { fetch } = require("@coffeebots/discord-backup");
fetch(backupID).then((backupInfos) => {
    console.log(backupInfos);
    /*
    {
        id: "BC5qo",
        size: 0.05
        data: {BackupData}
    }
    */
});

Remove

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

/**
 * @param {string} [backupID] - The ID of the backup to remove
 */

const { remove } = require("@coffeebots/discord-backup");
remove(backupID);

List

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

const { list } = require("@coffeebots/discord-backup");
list().then((backups) => {
    console.log(backups); // Expected Output [ "BC5qo", "Jdo91", ...]
});

SetStorageFolder

Updates the storage folder to another

const { create, setStorageFolder } = require("@coffeebots/discord-backup");
setStorageFolder(__dirname+"/backups/");
await create(guild); // Backup created in ./backups/

Advanced usage

Create [advanced]

You can use more options for backup creation:

const { create } = require("@coffeebots/discord-backup");
create(guild, {
    maxMessagesPerChannel: 10,
    jsonSave: false,
    jsonBeautify: true,
    doNotBackup: [ "roles",  "channels", "emojis", "bans" ],
    saveImages: "url"
});

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.
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.

Load [advanced]

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

const { load } = require("@coffeebots/discord-backup");
load(backupData, guild, {
    clearGuildBeforeRestore: true
});

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.

Restored things

Here are all things that can be restored with @coffeebots/discord-backup:

  • Server icon
  • Server banner
  • Server region
  • Server splash
  • Server verification level
  • Server explicit content filter
  • Server default message notifications
  • Server embed channel
  • Server bans (with reasons)
  • Server emojis
  • Server AFK (channel and timeout)
  • Server channels (with permissions, type, nsfw, messages, etc...)
  • Server roles (with permissions, color, etc...)

Example of things that can't be restored:

  • Server logs
  • Server invitations
  • Server vanity url

Support Us

If you find this project helpful and want to support our work, consider supporting us. Your support helps us maintain and improve this project.