Skip to content

missuo/discord-image

Repository files navigation

GitHub Workflow Go Version Docker Pulls

Discord Image

A powerful image hosting and file sharing service built with Discord Bot technology.

Note: Deployment requires a Discord Bot Token. You'll need to create a Discord application and bot to obtain this token. Please refer to Discord's official documentation for setup instructions.

Features

  • File size limits based on Discord tier:
    • Free users: 10MB
    • Discord Nitro Basic: 50MB
    • Discord Nitro: 500MB
  • Permanent storage - Files never expire
  • Upload management - View upload history and delete files
  • Multi-format support - Images, videos, and other file types
  • Custom proxy support - Configure custom proxy URLs for better accessibility
  • Server-friendly - Automatic file cleanup option to save server disk space
  • Self-hosted - Private deployment for enhanced security and control

Live Demo

Try the live demo at these endpoints:

Note: The demo configuration includes proxy_url and auto_delete settings for optimal performance in mainland China.

Demo Screenshot

For technical details about the implementation, read the blog post: https://missuo.me/posts/discord-file-sharing/

Quick Start with Docker

mkdir discord-image && cd discord-image
wget -O compose.yaml https://raw.githubusercontent.com/missuo/discord-image/main/compose.yaml
nano compose.yaml  # Edit configuration
docker compose up -d

Nginx Reverse Proxy Configuration

location / {
    proxy_pass http://localhost:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_http_version 1.1;
} 

Configuration

Configuration File

Important: Do not change the bot_token after initial setup, as this may invalidate existing file links.

bot:
  token: "" # Discord bot token
  channel_id: "" # Target channel ID

upload:
  temp_dir: "uploads" # Temporary directory for file storage

proxy_url: example.com # Custom proxy URL for cdn.discordapp.com (optional)
auto_delete: true # Auto-delete files from server after upload

Docker Environment Variables

For Docker deployments, use these environment variables instead of the configuration file:

services:
  discord-image:
    image: ghcr.io/missuo/discord-image
    ports:
      - "8080:8080"
    environment:
      - BOT_TOKEN=your_bot_token
      - CHANNEL_ID=your_channel_id
      - UPLOAD_DIR=/app/uploads
      - PROXY_URL=your_proxy_url  # Optional
      - AUTO_DELETE=true
    volumes:
      - ./uploads:/app/uploads

Configuration Notes

  • proxy_url: Optional setting for accessing Discord CDN from mainland China. If not needed, leave unset.
  • auto_delete: Saves server disk space by removing files after successful upload to Discord.

Setting Up Proxy URL (Optional)

Only required for mainland China access. Skip this section if not applicable.

Nginx Proxy Configuration

location / {
    proxy_pass https://cdn.discordapp.com;
    proxy_set_header Host cdn.discordapp.com;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_http_version 1.1;
}

Alternative: Cloudflare Workers

You can also deploy the proxy using serverless solutions like Cloudflare Workers. Community contributions for Workers configurations are welcome via PR.

Related Projects

License

AGPL-3.0

About

Powerful Discord image hosting, file sharing

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors 3

  •  
  •  
  •