A feature-rich Discord soundboard bot with multi-tenant AWS S3 cloud storage and PostgreSQL database integration that plays MP3 files in voice channels. Built for scalability, server isolation, and global accessibility.
- π΅ Cloud Audio Playback - Stream MP3 files directly from AWS S3
- π Multi-Tenant Architecture - Complete data isolation per Discord server
- βοΈ Cloud Storage - Store unlimited audio files in AWS S3 with server-specific folders
- ποΈ Database Integration - PostgreSQL support for persistent data and analytics
- π Organized Storage - Files stored in server-specific S3 folders (
audio/{server_id}/
) - πͺ Auto-Leave - Bot automatically leaves voice channel after playback
- π Volume Control - Adjust playback volume (0-100%)
- ποΈ Advanced Configuration - Custom prefixes, default volume, and server settings
- π File Management - Upload, delete, rename, and organize audio files per server
- π‘οΈ Permission System - Admin-only commands with role-based access
- π¬ Multiple Interfaces - Slash commands, text commands, and bot mentions
- π§Ή Maintenance Tools - Cloud file cleanup and comprehensive statistics
- π Interactive Help - Organized command help with category buttons
- π Global Performance - CDN-like streaming from AWS infrastructure
- π Scalability - Handle thousands of servers with isolated storage
- Isolated Storage: Each Discord server has its own S3 folder (
audio/{server_id}/
) - Data Separation: Complete isolation between different Discord servers
- Independent Collections: Servers cannot access each other's audio files
- Scalable Design: Supports unlimited servers with automatic folder creation
- PostgreSQL Support: Persistent data storage via Neon database
- Future Analytics: Ready for user stats, play counts, and usage tracking
- Connection Pooling: Efficient database connections with automatic cleanup
- Schema Ready: Extensible database design for future features
- Node.js 16.0.0 or higher
- Discord Bot Token (Discord Developer Portal)
- AWS Account with S3 access
- PostgreSQL Database (Neon recommended)
- FFmpeg installed on your system
-
Create Neon Account
- Go to Neon Console
- Create a new project
- Get connection string from dashboard
-
Database Configuration
- Database will auto-initialize on first run
- Connection pooling enabled by default
- SSL connections enforced
-
Create S3 Bucket
- Go to AWS S3 Console
- Create bucket (e.g.,
rdp-soundboard
) - Enable public read access for audio files
- Configure bucket policy for public access
-
Create IAM User
- Create user with S3 permissions:
s3:GetObject
,s3:PutObject
,s3:DeleteObject
,s3:ListBucket
- Generate access keys for the bot
- Create user with S3 permissions:
-
Configure Environment
- Set up AWS credentials and bucket information
- Configure S3 base URL for public access
-
Clone the repository
git clone https://github.com/rdp-datacenter/soundboard.git cd soundboard
-
Install dependencies
npm install
-
Configure environment
cp env.example .env
Edit
.env
and add your credentials:# Discord Configuration DISCORD_TOKEN=your_bot_token_here CLIENT_ID=your_application_client_id_here # Database Configuration NEON_DB_URL=postgresql://username:password@hostname/database?sslmode=require # AWS S3 Configuration AWS_ACCESS_KEY_ID=your_aws_access_key_here AWS_SECRET_ACCESS_KEY=your_aws_secret_key_here AWS_REGION=ap-south-1 S3_BUCKET_NAME=your_bucket_name S3_BASE_URL=https://bucket-name.region.s3.amazonaws.com S3_FOLDER=audio
-
Test connections
npm run test:s3 npm run test:db
-
Build and start
npm run build npm start
/play <filename>
- Play an MP3 file from your server's cloud storage/stop
- Stop audio and leave voice channel/volume [level]
- Set or check volume (0-100%)/list [detailed]
- Show all available MP3 files in your server's collection
/upload <file>
- Upload MP3 files to your server's cloud storage (Admin only)/delete <filename>
- Delete audio files from your server's storage (Admin only)/rename <oldname> <newname>
- Rename files in your server's collection (Admin only)/cleanup
- Remove corrupted files from your server's S3 folder (Owner only)/stats
- Show bot and server-specific storage statistics (Admin only)/defaultvolume [level]
- Set default volume for new voice connections (Admin only)
/ping
- Check bot latency/help [category]
- Interactive command help/prefix [new_prefix]
- Set or view custom text command prefix (Admin only)/settings
- View and manage server configuration (Admin only)
!play filename.mp3
- Alternative to slash commands@RDP Soundboard filename.mp3
- Play via bot mention!help
,!ping
,!volume 75
- Text equivalents
src/
βββ commands/
β βββ audio/ # Music & playback commands
β β βββ play.ts # Play audio files from cloud storage
β β βββ stop.ts # Stop playback and leave voice channel
β β βββ volume.ts # Real-time volume control
β β βββ list.ts # List server's audio collection
β βββ admin/ # Administrative commands
β β βββ upload.ts # Upload files to server's S3 folder
β β βββ delete.ts # Delete files from server's storage
β β βββ rename.ts # Rename files in server's collection
β β βββ cleanup.ts # Clean up corrupted/invalid files
β β βββ stats.ts # Server-specific storage statistics
β β βββ defaultvolume.ts # Set default volume for server
β βββ utility/ # General utilities & configuration
β βββ ping.ts # Bot latency check
β βββ help.ts # Interactive command help system
β βββ prefix.ts # Configure text command prefix
β βββ settings.ts # Server configuration management
βββ handlers/
β βββ commandHandler.ts # Auto-discovery command loader
βββ types/
β βββ Command.ts # TypeScript interfaces & types
βββ utils/
β βββ permissions.ts # Role-based permission system
β βββ s3.ts # S3 service with multi-tenant support
β βββ db.ts # PostgreSQL database service
βββ index.ts # Main bot entry point & initialization
- Bucket Setup: Create S3 bucket with public read access
- Storage Location: Global AWS infrastructure
- Server Isolation: Each Discord server gets isolated folder (
audio/{server_id}/
) - File Organization: Server-specific file collections
- Folder Structure: Files stored as
{S3_FOLDER}/{server_id}/filename.mp3
- File Limits: Virtually unlimited storage capacity per server
- Supported Formats: MP3 files only
- Access: Files accessible via direct S3 URLs
- Performance: CDN-like global distribution
- Auto-Cleanup: Bot automatically leaves voice channels after playback
- Database Provider: Neon PostgreSQL (recommended)
- Connection: SSL-enforced connections with pooling
- Schema: Auto-initializes on first run
- Multi-Tenant: Server-specific data isolation
- Future Features: Ready for analytics, user stats, play tracking
- Multi-Tenant Path:
{S3_FOLDER}/{server_id}/filename.mp3
- Server Isolation: Complete separation between Discord servers
- Folder Path: Set via
S3_FOLDER
environment variable (default: "audio") - Benefits: Better organization, server isolation, easier management
- File References: All commands automatically use server-specific folders
- URL Format:
https://your-bucket.s3.region.amazonaws.com/audio/server_guildid/filename.mp3
- Flexible: Can be changed to any base folder name
- Path Display: All commands display the current server's folder path
- Members: Can use audio playback commands for their server
- Administrators: Can upload/delete files and view stats for their server
- Owner: Can perform cleanup operations for their server
The following npm scripts are available in package.json
:
npm run build # Compile TypeScript using tsc and tsc-alias
npm run test:s3 # Test S3 connection and configuration
npm run test:db # Test database connection
npm run start # Start the bot from compiled JavaScript
npm run dev # Run the bot directly using ts-node (development mode)
npm run watch # Watch for changes and recompile TypeScript
npm run clean # Remove the dist directory
- Create command file in appropriate subfolder (
src/commands/category/
) - Export command object with
data
andexecute
properties - Use
context.guildId
for server-specific operations - The command handler will automatically discover and load it
DISCORD_TOKEN
- Your bot's tokenCLIENT_ID
- Your Discord application's client IDNEON_DB_URL
- PostgreSQL connection stringAWS_ACCESS_KEY_ID
- AWS access key for S3AWS_SECRET_ACCESS_KEY
- AWS secret key for S3AWS_REGION
- AWS region (e.g., us-east-1)S3_BUCKET_NAME
- Your S3 bucket nameS3_BASE_URL
- Public S3 URL for your bucketS3_FOLDER
- Base folder inside S3 bucket (default: "audio")
- π Multi-Tenant Architecture: Complete server isolation with dedicated storage folders
- ποΈ Database Integration: PostgreSQL support for persistent data and future analytics
- βοΈ Cloud-First Architecture: Files stored in AWS S3 for global accessibility
- π Server-Specific Storage: Each Discord server has isolated file collections
- π Auto-Discovery: Commands are automatically loaded from subfolders
- π‘οΈ Type Safety: Full TypeScript support with proper error handling
- ποΈ Volume Control: Real-time volume adjustment with server-specific defaults
- π Autocomplete: File name suggestions from server-specific cloud storage
- βοΈ Server Configuration: Custom prefixes, default settings, and server management
- π File Operations: Upload, delete, rename, and organize files with cloud storage
- π§Ή Cloud Maintenance: Built-in S3 file cleanup and health monitoring per server
- π Advanced Statistics: Comprehensive bot, storage, and server-specific analytics
- π Global Performance: Stream audio from AWS edge locations
- πΎ Unlimited Storage: No local disk space limitations per server
- π Auto-Scaling: Handle any number of servers with automatic folder creation
- π° Cost Tracking: Monitor and estimate AWS S3 costs across all servers
If you're upgrading from a previous version:
- Backward Compatibility: Existing files remain accessible in root folder
- Automatic Migration: New uploads automatically use server-specific folders
- Gradual Transition: Files can be manually moved to server folders as needed
- Database Schema: Automatically initializes on first database connection
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include error logs and system information
Keep your servers entertained with isolated, scalable sound collections!