refactor(send_to_discord): change toggle parameters from strings to booleans

The parameters 'send_to_discord' and 'batch_mode' were previously using string values "enable"/"disable" which was less intuitive. Changed to boolean type for better clarity and type safety. Also updated version to 1.2.2 in pyproject.toml.
This commit is contained in:
gmorks
2025-07-13 21:00:20 -06:00
parent 83bc1f2158
commit c02f967094
2 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-sendtodiscord"
description = "ComfyUI-SendToDiscord is a custom node for ComfyUI that simplifies sending preview images to Discord via webhooks. It supports both single-image uploads and batch mode, making it an efficient tool for sharing your generated images directly with your Discord server."
version = "1.2.1"
version = "1.2.2"
license = {file = "LICENSE"}
dependencies = ["Pillow>=9.5.0", "requests>=2.28.2", "numpy>=1.23.5"]
+8 -8
View File
@@ -153,8 +153,8 @@ class PreviewImageWithDiscord:
"""
return {"required":
{"images": ("IMAGE", ),
"send_to_discord": (["enable", "disable"], {"default": "disable"}),
"batch_mode": (["enable", "disable"], {"default": "disable"})},
"send_to_discord": ("BOOLEAN", {"default": False}),
"batch_mode": ("BOOLEAN", {"default": False})},
"optional":
{"passthrough_image": ("IMAGE", )},
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
@@ -166,14 +166,14 @@ class PreviewImageWithDiscord:
OUTPUT_NODE = True
CATEGORY = "image"
def preview_images(self, images, send_to_discord="disable", batch_mode="disable", passthrough_image=None, prompt=None, extra_pnginfo=None):
def preview_images(self, images, send_to_discord=False, batch_mode=False, passthrough_image=None, prompt=None, extra_pnginfo=None):
"""
Previews images and optionally sends them to Discord.
Args:
images (list): List of images to preview.
send_to_discord (str): Whether to send images to Discord ("enable" or "disable").
batch_mode (str): Whether to send images in batch mode ("enable" or "disable").
send_to_discord (bool): Whether to send images to Discord.
batch_mode (bool): Whether to send images in batch mode.
passthrough_image (list, optional): Optional image input for passthrough.
prompt (str, optional): Prompt text to add as metadata.
extra_pnginfo (dict, optional): Additional PNG info to add as metadata.
@@ -205,13 +205,13 @@ class PreviewImageWithDiscord:
})
# Send image to Discord if enabled
if send_to_discord == "enable" and self.webhook_url:
if send_to_discord and self.webhook_url:
# Extract workflow JSON if available
workflow_json = None
if extra_pnginfo and 'workflow' in extra_pnginfo:
workflow_json = extra_pnginfo['workflow']
if batch_mode == "enable":
if batch_mode:
# Store both image path and workflow JSON for batch processing
self.image_queue.append((full_path, file, workflow_json))
if len(self.image_queue) >= self.batch_size:
@@ -222,7 +222,7 @@ class PreviewImageWithDiscord:
counter += 1
# Send any remaining images in the queue
if send_to_discord == "enable" and batch_mode == "enable" and self.image_queue:
if send_to_discord and batch_mode and self.image_queue:
self.send_batch_to_discord()
# Log workflow JSON if available (useful for debugging and potential future features)