ComfyUI Node

Discord Serving

The node that turns ComfyUI into a Discord bot

By matan1905·Created 3 years ago·Updated about a year ago· 71
Discord Serving
    • Serving config
    discord_token

    DiscordServing is the node that started this whole pack, and it's the one most people land on first: it makes your ComfyUI workflow answer !generate <prompt> in a Discord channel and post the result as a reply. No separate bot service, no API layer you have to maintain - the node is the bot, running inside your graph. For a friend-group bot or a public server that generates from your own GPU, it's the fastest path from "I have a cool workflow" to "my friends can use it."

    Mechanically it's discord.py running in a background thread. The node keeps a queue; when a message starting with ! arrives, it parses the command with the toolkit's parse_command_string, stuffs the result into a Serving config, and the graph's output nodes post the reply. The parsing is the same syntax across the whole pack: !generate a robot saying hello --negative blurry puts "a robot saying hello" in the prompt argument and "blurry" in negative. Attach an image and it becomes attachment_url_0 (then _1, _2…), which is how the image-input nodes feed img2img.

    You only set one input on the node itself: discord_token. Get it from the Discord Developer Portal, and here's the gotcha that burns almost everyone: you have to enable the Message Content intent for your bot, or it won't see command text at all. The README points at a WriteBots tutorial for the token steps and calls out the intent explicitly. Skip it and the bot logs in fine and then does nothing.

    The output is a Serving config - wire it into ServingInputText, ServingInputNumber, ServingInputImage, and one or more output nodes. Which output you attach controls what the bot sends back:

    • ServingOutput replies with an image (an animated webp if your graph produced a batch of frames).
    • ServingMultiImageOutput replies with several separate PNG files instead.
    • ServingTextOutput sends a plain text reply - handy for !help or returning generation metadata.

    One claim in the README is worth understanding: it says the workflow is never embedded in the served images, so "your secrets are 100% safe." That's marketing-flavored but basically true - the bot serves images over Discord's API rather than through the standard save-node path that bakes workflow JSON into PNG metadata. If you're paranoid about leaking your workflow, that's a genuine plus, not just a slogan.

    Install via ComfyUI Manager (search "Serving Toolkit") or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/matan1905/ComfyUI-Serving-Toolkit
    cd ComfyUI-Serving-Toolkit
    pip install -r requirements.txt
    

    Dependencies are discord.py plus websocket-client, rel, pyTelegramBotAPI, and opencv-python; no model downloads - the node only serves what your workflow already loads.

    Troubleshooting in order of likelihood: (1) Auto Queue isn't enabled, so the graph ran once and the bot stopped polling - the README's "Running" section shows the toggle; (2) the token is wrong or the Message Content intent is off; (3) you forgot a CommandPickerServing or AlwaysExecute node, so the bot silently ignores every command because nothing registered it. The last one is subtle because there's no error - messages just get dropped. If your bot says nothing, check that an output gate exists before debugging the token.

    CategoryServing-Toolkit

    Inputs (1)

    NameTypeDefaultDescription
    discord_tokenSTRING

    Outputs (1)

    NameTypeDescription
    Serving configSERVING_CONFIG