Discord Backup
Note: this module uses recent discordjs features and requires discord.js version 12.
Discord Backup is a powerful Node.js module that allows you to easily manage discord server backups.
- 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!)
Changelog
- Supports base64 for emojis/icon/banner backup
- New option to save backups in your own database
backup#delete()
removed in favor ofbackup#remove()
Installation
npm install --save discord-backup
Functions
Create
Create a backup for the server specified in the parameters!
/** * @param * @param */ const backup = ;backup;
Click here to learn more about backup options.
Load
Allows you to load a backup on a Discord server!
/** * @param * @param */ const backup = ;backup;
Fetch
Fetches information from a backup
/** * @param */ const backup = ;backup;
Remove
Warn: once the backup is removed, it is impossible to recover it!
/** * @param */ const backup = ;backup;
List
Note: backup#list()
simply returns an array of IDs, you must fetch the ID to get complete information.
const backup = ;backup;
SetStorageFolder
Updates the storage folder to another
const backup = ;backup;await backup; // Backup created in ./backups/backup;await backup; // Backup created in ./my-backups/
Advanced usage
Create [advanced]
You can use more options for backup creation:
const backup = ;backup;
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 backup = ;backup;
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.
Example Bot
// Load modulesconst Discord = backup = client = settings = prefix: "b!" token: "YOURTOKEN"; client; client; //Your secret token to log the bot in. (never share this to anyone!)client;
Restored things
Here are all things that can be restored with 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