Skip to content

AEmotionStudio/ComfyUI-DiscordSend

Repository files navigation

ComfyUI-DiscordSend

Version ComfyUI License

Send your AI-generated images and videos directly to Discord from ComfyUI!

ComfyUI-DiscordSend provides custom nodes for ComfyUI that allow you to seamlessly:

  • Save images and videos locally with advanced formatting options
  • Send images, videos, and workflows directly to Discord via webhooks
  • Include prompt information and metadata with your creations
  • Maintain unique identifiers between different users and uploads
  • Archive Discord CDN URLs to GitHub repositories for easy access

Tip

Perfect for sharing your creations with communities, friends, or your own archive channels!

Example workflow

✨ Features

πŸ–ΌοΈ Image Node: DiscordSendSaveImage

  • Save images in various formats (PNG, JPEG, WebP)
  • Send images directly to Discord via webhooks
  • Include workflow JSON for easy reproduction
  • Customizable Discord messages with prompt information
  • Advanced file naming with date, time, and dimension options
  • High-quality image export with configurable compression settings
  • Built-in preview functionality within ComfyUI interface
  • Batch grouping support (up to 9 images per Discord message)
  • Unique identifier support to prevent conflicts between users

🎬 Video Node: DiscordSendSaveVideo

  • Convert image sequences to videos in multiple formats
  • Support for GIF, MP4, WebM, and professional formats like ProRes
  • Configurable frame rates from 0.1 to 120 fps (slow-motion to time-lapse)
  • Extra-slow frame rates below 1 fps for photo slideshows (e.g., 0.5 fps = 2 seconds per image)
  • Add audio to your videos (when supported by format)
  • Special effects like ping-pong looping
  • Discord integration for sharing videos
  • Include workflow data and video information in messages
  • UUID support for distinguishing between multiple user uploads

πŸ”„ GitHub Integration

  • Save Discord CDN URLs to a GitHub repository
  • Automatically update existing URL collections with new uploads
  • Formatted markdown files with timestamps and organized links
  • Perfect for building media galleries or documentation
  • Comprehensive security measures for GitHub tokens

πŸ“₯ Installation

Option 1: Using ComfyUI Manager

  1. Install ComfyUI Manager if you don't have it already
  2. Open ComfyUI, go to the Manager tab
  3. Search for "ComfyUI-DiscordSend" and install

Option 2: Manual Installation

cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/AEmotionStudio/ComfyUI-DiscordSend
cd ComfyUI-DiscordSend
pip install -r requirements.txt  # Installs the minimal requirements (only the requests library)

Important

  • For video functionality, ffmpeg must be installed on your system. The node will automatically detect its presence.
  • This extension has minimal dependencies, requiring only the 'requests' library which is included in the requirements.txt file.

πŸš€ Usage

Discord Webhook Setup

Step 1: Access Webhook Settings

  1. In Discord, go to your server settings β†’ Integrations β†’ Webhooks

Discord webhook settings

Step 2: Create and Copy Webhook

  1. Create a New Webhook and copy the Webhook URL

Create and copy webhook Create and copy webhook

Step 3: Configure the Node

  1. Paste this URL into the "webhook_url" field in the DiscordSend nodes

Configure webhook in node

Webhook Auto-Sanitization

ComfyUI-DiscordSend includes an automatic webhook sanitization feature that:

  • Strips out sensitive parts of the webhook URL when displaying in logs
  • Automatically converts various Discord webhook URL formats to the standard format
  • Supports Discord webhook URLs from different domains (discord.com, discordapp.com)
  • Validates webhook URLs before sending to help prevent errors
  • Preserves the webhook token internally for actual API calls while hiding it from exposure
  • Removes webhook URLs from workflow JSON files before they're sent to Discord
  • Sanitizes image metadata to prevent webhook URLs from being embedded in saved images
  • Filters webhook URLs from Discord messages to prevent accidental token sharing
  • Ensures that webhook URLs are never exposed through any generated content, so long as you are using these nodes to save and not other save nodes in combination (as other save nodes will not sanitize the webhook url when saving alongside this one).

This comprehensive sanitization helps protect your Discord server's webhook tokens from accidental exposure in logs, screenshots, saved files, or shared content while making it easier to use any webhook URL format.

Warning

Security Recommendation: It is strongly recommended to only share access to your server webhook with trusted users. Creating individual webhook integrations per user makes it easier to identify which user is sending content to your Discord server. Using a single webhook for multiple users makes content moderation difficult as all uploads will appear under the same webhook identity.

GitHub Integration Setup

The GitHub integration allows you to automatically save Discord CDN URLs to a GitHub repository.

  1. Create a personal access token with public_repo permissions on GitHub
  2. Configure the GitHub options in the node:
    • github_cdn_update: Enable to activate GitHub integration
    • github_repo: Your repository in format username/repo
    • github_token: Your personal access token
    • github_file_path: Path to the file in repository (default: cdn_urls.md)

Note

GitHub tokens are secured with the same comprehensive sanitization as webhook URLs. Tokens are:

  • Hidden from logs with [REDACTED_TOKEN]
  • Removed from workflow JSON files before sharing
  • Sanitized from image metadata
  • Protected in error messages and tracebacks

Image Node

  1. Add the DiscordSendSaveImage node to your workflow
  2. Connect your image output to this node
  3. Configure saving and Discord options
  4. Run your workflow!

Batch Image Handling

When sending multiple images in a batch:

  • Up to 9 images can be grouped in a single Discord message
  • Enable group_batched_images to combine images from a batch
  • Batches larger than 9 images will be split into multiple messages
  • Each batch maintains the same workflow JSON if enabled

Video Node

  1. Add the DiscordSendSaveVideo node to your workflow
  2. Connect your image sequence to this node
  3. Set frame rate, format, and other video options
  4. Optionally connect audio
  5. Run your workflow to create and send videos!

Creating Photo Slideshows

You can now create slideshow videos from still images:

  • Use frame rates below 1 to make each image stay longer on screen
  • Example: 0.5 fps = 2 seconds per image
  • Example: 0.25 fps = 4 seconds per image
  • Example: 0.1 fps = 10 seconds per image
  • Perfect for creating galleries and presentations from your images

Note

  • The video node does not display a preview in the ComfyUI interface, unlike the image node
  • For best Discord compatibility, keep videos under 8MB (or 50MB for servers with boosts)

πŸ“± Discord Message Preview

Here's how your images and videos will appear in Discord when sent using ComfyUI-DiscordSend:

Discord message formatting

The node formats messages with:

  • Optional custom message text
  • Generation prompts when enabled
  • Technical details about the media
  • Professional presentation with markdown formatting
  • Attached workflow JSON file when enabled
  • Image galleries for batch uploads (up to 9 images per message)

πŸ“ Configuration Options

DiscordSendSaveImage Options

Option Description
Required Parameters
images The images to save and/or send to Discord
filename_prefix Prefix for saved files (default: "ComfyUI-Image")
overwrite_last Enable to overwrite last image instead of incrementing filenames
File Options
file_format PNG, JPEG, or WebP
quality 1-100 for JPEG/WebP formats
lossless Use lossless compression when available
save_output Whether to save images to disk
show_preview Show preview in ComfyUI interface
Filename Options
add_date Add current date to filenames
add_time Add current time to filenames
add_dimensions Add width and height to filenames
resize_to_power_of_2 Resize to nearest power of 2 dimensions
resize_method Method for resizing (nearest, bilinear, etc.)
Discord Options
send_to_discord Enable Discord webhook integration
webhook_url Discord webhook URL
discord_message Text message to accompany images
include_prompts_in_message Include generation prompts in Discord message
include_format_in_message Include image format details in message
group_batched_images Group batch images into one Discord message (max 9 images)
send_workflow_json Send workflow JSON for reproducibility
GitHub Options
save_cdn_urls Save the Discord CDN URLs as a text file and attach to Discord message
github_cdn_update Update a GitHub repository with Discord CDN URLs
github_repo GitHub repository in format "username/repo"
github_token GitHub personal access token (with repo permissions)
github_file_path Path to file in repository to update (default: "cdn_urls.md")

DiscordSendSaveVideo Options

Option Description
Required Parameters
images Image sequence to convert to video
filename_prefix Prefix for saved files (default: "ComfyUI-Video")
overwrite_last Enable to overwrite last video instead of incrementing filenames
Video Options
format Various formats including GIF, MP4, WebM, ProRes
frame_rate Frames per second (0.1-120), values below 1 make images stay longer
quality Quality setting for compression (1-100)
loop_count Number of loops for GIF (0=infinite)
lossless Use lossless compression when available
pingpong Create forward-backward looping effect
save_output Whether to save video to disk
audio Optional audio to embed in video
Filename Options
add_date Add current date to filenames
add_time Add current time to filenames (DO NOT DISABLE for Discord uploads - see known issues)
add_dimensions Add width and height to filenames
Discord Options
send_to_discord Enable Discord webhook integration
webhook_url Discord webhook URL
discord_message Text message to accompany videos
include_prompts_in_message Include generation prompts in Discord message
include_video_info Include video format details in message (disable if you don't want time/format info)
send_workflow_json Send workflow JSON for reproducibility
GitHub Options
save_cdn_urls Save the Discord CDN URLs as a text file and attach to Discord message
github_cdn_update Update a GitHub repository with Discord CDN URLs
github_repo GitHub repository in format "username/repo"
github_token GitHub personal access token (with repo permissions)
github_file_path Path to file in repository to update (default: "cdn_urls.md")

πŸ“‹ Requirements

  • ComfyUI (latest version recommended)
  • Python 3.8+
  • Python dependencies: Only the 'requests' library (automatically installed via requirements.txt)
  • For video functionality: ffmpeg (system-level dependency)

❓ Troubleshooting

Warning

If Discord fails to receive your media, check:

  • File Size: Discord has upload limits (8MB for regular servers, 50MB for boosted servers)
  • Webhook URL: Ensure your webhook URL is valid and has not been regenerated

Discord Limitations

  • Video Processing: Discord reprocesses all uploaded videos to optimize for their platform. This means:

    • Original quality settings may be modified regardless of what you set
    • Videos may be compressed further even with high-quality settings
    • Some formats may be converted to different formats by Discord
    • Previews may not be available immediately after upload
    • Maximum resolution is limited (typically 1080p)
    • Maximum bitrate may be reduced based on server boost level
  • Image Limitations:

    • Maximum of 9 images per message/gallery
    • Images over 10MB may be refused

Troubleshooting

  1. Videos not playing in Discord

    • Try using more compatible formats like h264-MP4
    • Reduce quality settings to decrease file size
    • Make sure add_time is enabled
  2. "ffmpeg not found" warning

    • Install ffmpeg on your system and ensure it's in your PATH
    • Restart ComfyUI after installation
  3. Webhook errors

    • Verify webhook URL is correct and the channel still exists
    • Check Discord's status if all webhooks are failing
  4. UUID Support and Conflicts

    • Each upload includes a UUID to prevent conflicts between users
    • If you experience files overwriting each other, ensure multiple users aren't sharing the same output directory
  5. GitHub Integration Issues

    • Verify your token has proper permissions (needs 'public_repo' scope)
    • Ensure the repository exists and you have write access
    • Check that the file path is valid and doesn't conflict with existing directories

Known Issues

  1. Critical: Do NOT disable add_time for videos sent to Discord
    • When the add_time option is disabled for videos being sent to Discord, they may appear as a single frame or static image
    • If you want to omit time information in Discord messages, disable include_video_info instead
    • This is a limitation of how Discord identifies and processes video files

🀝 Contributing

Contributions are welcome! Feel free to:

  • Report bugs
  • Suggest features
  • Submit pull requests

Please follow the standard GitHub flow for contributions.

πŸ™ Acknowledgements

  • ComfyUI team for the amazing platform
  • All contributors and users who provide feedback

πŸ”— Connect with me

β˜• Support

If you find ComfyUI-DiscordSend useful, consider supporting its development:

ko-fi

Your support helps me dedicate more time to maintaining and improving this project and others with new features, bug fixes, and better documentation.

πŸ’– Additional Ways to Support

  • ⭐ Star the repository
  • πŸ“’ Share it with others
  • πŸ› οΈ Contribute to its development

For business inquiries or professional support, please contact me through my website or join my Discord server.

πŸ“œ License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

About

A ComfyUI extension that enables seamless sharing of AI-generated images and videos directly to Discord.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages