Discopy is a focused Discord server backup and restore utility built on top of the @eliware/discord framework. It provides commands and tooling to export a guild's configuration (roles, channels, permissions, emojis, stickers, events, invites, webhooks, etc.) into portable backups and to restore them into another guild. The project is ESM-first and designed to be run locally, as a systemd service, or inside Docker.
- Features
- Getting Started
- Configuration
- Running as a Service (systemd)
- Docker
- Architecture & Files
- Customization
- Testing
- Support
- License
- Backup and restore full guild configuration (roles, channels, categories, overwrites).
- Export emojis and stickers into backups and re-upload on restore.
- Recreate invites, webhooks, events, and bans during restore.
- CLI-style Discord commands:
backup,restore,reset, andhelpfor interactive use. - Optional scheduled daily backups implemented in
events/clientReady.mjs(default: 04:00 Eastern / 09:00 UTC). - Localized command and response strings under
locales/. - Safe sequential processing to reduce rate-limit bursts when running backups/restores.
-
Clone this project:
git clone https://github.com/eliware/discopy.git cd discopy npm install -
Set up your environment:
- Copy
.env.exampleto.envand fill in your Discord bot token and any other required values. Typical values you will provide include yourDISCORD_TOKEN(bot token) and optional configuration such as backup paths or scheduling toggles. See.env.examplefor the exact variables used by the app.
- Copy
-
Start the app locally:
npm start # or node discopy.mjs -
Use the commands in Discord:
backup— create and save a backup for the current guild (creates a ZIP underbackups/).restore— restore a previously created backup into the current guild.reset— helper to apply default configuration to a guild.help— list available commands and usage.
- All runtime configuration is loaded from the
.envfile viadotenv. Copy.env.exampleand populate secrets and optional flags. - Scheduling: the bot contains a scheduler in
events/clientReady.mjsthat will optionally run daily backups at 09:00 UTC (04:00 EST). The code comments explain how to change time and DST behavior.
-
Copy
discopy.serviceto/usr/lib/systemd/system/discopy.service. -
Edit the paths and user/group as needed (point
ExecStartto the installation path ofdiscopy.mjs). -
Reload systemd and start the service:
sudo systemctl daemon-reload sudo systemctl enable discopy sudo systemctl start discopy sudo systemctl status discopy
-
Build the Docker image:
docker build -t discopy . -
Run the container (pass
.envfor configuration):docker run --env-file .env discopy
- Command handlers:
commands/— each command has a.jsondefinition for Discord plus a.mjsruntime handler. Key commands:backup,restore,reset,help. - Backup collectors:
src/backup/— modules such ascollectGuild.mjs,collectEmojis.mjs, andsaveZip.mjsbuild and persist backup ZIPs. - Restore helpers:
src/restore/— many small, focused modules (e.g.createRoles.mjs,createChannels.mjs,uploadEmojis.mjs) re-create guild state from a backup archive. - Reset flow:
src/reset/— contains the logic to apply default settings and plans when resetting a guild. - Event wiring:
events/clientReady.mjs— sets presence, pre-fetches members (whenGUILD_MEMBERSintent is enabled), and schedules daily backups.
- Add or modify commands in the
commands/directory; update the corresponding.jsonto change registration and localization. - Event handlers live in
events/and are auto-registered by the framework used indiscopy.mjs. - Localization files live in
locales/— add languages or adjust translations used by command.jsonfiles and runtime responses.
-
Run the project's test suite with:
npm test
For help, questions, or to chat with the author and community, visit:


