A modern discord.js v14 MySQL backup bot with slash commands, prefix commands, SQLite-backed state, and scheduled archive generation built for clean public deployment.
AutoBackup Bot is a production-style Discord utility for managing MySQL backup targets from inside a Discord server. It is designed as a clean public repo with environment-based configuration, modern command structure, and a lightweight SQLite layer for local bot state.
This version is organized like a polished Techlyn Developments project: simple to clone, easy to configure, and ready to publish as a portfolio-quality GitHub repository.
- Dual command support with slash commands and prefix commands
- Modern
src/structure for commands, events, services, config, and database logic - SQLite database for bot settings, registered backup targets, and backup logs
- MySQL dump generation using
mysqldump - Gzip-compressed backup archives for cleaner storage
- Scheduled automatic backups with configurable interval
- Manual backup controls for single targets or all targets
- Public-repo ready environment configuration with no hardcoded secrets
.
|-- src
| |-- commands
| |-- config
| |-- database
| |-- events
| |-- services
| |-- utils
| |-- index.js
| `-- register-commands.js
|-- .env.example
|-- .gitignore
|-- package.json
|-- index.js
`-- register.js
| Slash | Prefix | Description |
|---|---|---|
/add |
!add |
Add or update a MySQL backup target |
/remove |
!remove |
Remove a backup target |
/list |
!list |
Show all registered targets |
/backup |
!backup |
Run a manual backup for one target or all targets |
/settings |
!settings |
Manage interval, notifications, and auto-backup state |
/panel |
!panel |
Open the quick-action backup control panel |
/help |
!help |
Show command usage |
- Node.js
18.17+recommended - npm
9+ - A Discord bot application
- Access to one or more MySQL databases
npm installThe repo includes .env.example.
Create a local .env file with values like this:
DISCORD_TOKEN=your_bot_token
CLIENT_ID=your_discord_application_client_id
GUILD_ID=your_test_server_id
PREFIX=!
OWNER_IDS=123456789012345678,987654321098765432
BACKUP_DIR=backups
SQLITE_PATH=data/autobackup.sqlite
AUTO_BACKUP_INTERVAL_MINUTES=60
BACKUP_NOTIFY_CHANNEL_ID=123456789012345678
BACKUP_TIMEZONE=Asia/Calcutta- Open the Discord Developer Portal.
- Create a new application.
- Open the
Bottab and create a bot user. - Copy the bot token into
DISCORD_TOKEN. - Copy the application ID into
CLIENT_ID. - If you want fast slash-command updates while testing, put your server ID in
GUILD_ID.
In the Discord Developer Portal, enable:
Server Members Intentonly if you later expand member-based featuresMessage Content Intentbecause prefix commands use message content
Use an OAuth2 URL with:
botapplications.commands
Recommended bot permissions:
View ChannelsSend MessagesEmbed LinksAttach FilesRead Message HistoryUse Slash CommandsManage Guildfor admins who should control backups
npm run registerIf GUILD_ID is set, commands are registered instantly to that server.
If GUILD_ID is empty, commands are registered globally and can take longer to appear.
npm startFor development with reloads:
npm run dev/add name:main-db connection:mysql://user:password@127.0.0.1:3306/database_nameOr with the prefix command:
!add main-db mysql://user:password@127.0.0.1:3306/database_name/backup name:main-dbOr:
!backup main-dbTo back up everything:
!backup all/settings interval minutes:120Or:
!settings interval 120/settings enableOr:
!settings enableSQLite stores:
- Bot settings
- Registered MySQL targets
- Backup log history
- Last backup timestamps
Generated backup files are written to the directory defined by BACKUP_DIR.
- Rotate any old tokens or credentials before publishing the repository
- Keep
.env, backup archives, and SQLite files out of git - This public build does not expose raw SQL execution commands
- If you are publishing this as a Techlyn Developments project, you can safely use this README as the base presentation
npm start
npm run dev
npm run registerThis project is currently marked with the ISC license in package.json.