Skip to content

ambocclusion/ComfyUI-SDXL-DiscordBot

 
 

Repository files navigation

CarbBot

CarbBot makes your weirdest fantasies come true~~

Features

  • Uses ComfyUI and ComfyScript to generate images!
  • Works across many Discord servers and in DMs
  • SDXL, Stable Cascade, and SD1.5
  • LoRAs
  • GIF Generation through AnimateDiff
  • Aspect ratios!
  • img2img, inpainting, image mashups (through Stable Cascade)
  • Music generation!

Installation

Ensure python 3.10 exactly is installed on your system. Also ensure that git is installed. If you wish to use a separately hosted ComfyUI instance, please follow the manual instructions.

Before Installation

Create your Discord app by going to the Discord Developer Portal. Create a new application and bot. Copy the token and put it in the config.properties file. You will also need to invite the bot to your server. You can do this by going to the OAuth2 tab and selecting the bot scope. Then select the permissions you want the bot to have. Copy the link and paste it into your browser. Select the server you want to invite the bot to and click authorize.

Automatic

Linux

git clone https://github.com/ambocclusion/ComfyUI-SDXL-DiscordBot.git
cd ComfyUI-SDXL-DiscordBot
chmod +x setup.sh
./setup.sh

This will create a venv and install ComfyUI in the embedded_comfy directory. Put your key in the config.properties file. Please follow the After Installation instructions after completion.

Windows

Open a command prompt or Powershell and run the following commands:

git clone https://github.com/ambocclusion/ComfyUI-SDXL-DiscordBot.git
cd ComfyUI-SDXL-DiscordBot
./setup.bat

After Installation

Please put all of your checkpoints in embedded_comfy/models/checkpoints/<sdversion> directory. Install any required custom nodes and put any LoRAs in embedded_comfy/models/loras directory. In order for upscaling to work you will need to download an upscaler model like RealESRGAN_x4plus and place it in the embedded_comfy/models/upscale_models directory.

Links to models

This bot is also compatible with other models found on HuggingFace and Civit.ai.

NSFW Detection

Basic NSFW detection can be enabled on the bot to spoiler NSFW images. It's disabled by default, but can be enabled in config.properties. There are two layers to this detection. The first layer will simply spoiler the image if the prompt contains a word from a configurable blacklist of NSFW terms. The second layer is image nudity detection provided through the lightweight NudeNet package. In order to use it, you will need to grab one of the .onnx models from the project's github and place it in the data/ folder. The blacklist of types of nudity can be configured using the classes found on the NudeNet readme. Note that this layer doesn't work with animated images or videos.

Manual

ComfyUI Dependencies

Instructions

Install ComfyUI and ensure the --listen flag is set during launch. Install each of the above nodes in the custom_nodes folder. In a folder separate from ComfyUI run the following commands in a terminal or CLI:

git clone https://github.com/ambocclusion/ComfyUI-SDXL-DiscordBot.git
cd ComfyUI-SDXL-DiscordBot
pip install -r requirements.txt

Copy or rename the config.properties.example file to config.properties and set your Discord bot token in [BOT] -> TOKEN. Ensure the [LOCAL] -> SERVER_ADDRESS is set to an address that includes http:// or https://.

CarbBot should detect models and loras in your models directory. To make sure the models show up in the correct commands, make sure your models are put in the following structure:

- ComfyUIRoot
    - models
        - checkpoints
            - 15
            - sdxl
            - cascade
        - loras
            - 15
            - sdxl
            - cascade
        - upscale_models

Launch the bot with python __main__.py.

Future Plans

  • LLM to enhance prompts and talk with the responses
  • Customize which commands you'd like to use
  • Better UI for interactions
  • Model and lora editing in the Edit modal

About

Simple Discord Bot for interfacing with ComfyUI and/or the Stability AI API for text2image generation using the SDXL model

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 93.1%
  • Shell 3.3%
  • Batchfile 3.2%
  • Dockerfile 0.4%