/stable-diffusion-discord-bot

A discord bot to generate AI art from prompts using invokeAI

Primary LanguageJavaScriptThe UnlicenseUnlicense

stable-diffusion-discord-bot

A discord bot built to interface with the InvokeAI fork of stable-diffusion.

top.gg discord license size last commit twitter

Current features:

  • ✅ Most features from InvokeAI are available via bot
  • 🔁 Simple buttons for refresh and using templates/init-images
  • 🖼️ Attach an image with your chat message to use as template/init-image
  • 🧊 Basic FIFO queue system
  • 📂 Watch folder for new files, autopost to discord with filename/info if available
  • 📄 Supports loading prompt, keywords and settings from txt files with randomisation
  • 🖼️ RealESRGAN face fixing and upscaling
  • ⚔️ Slash commands
  • 💳 Per user credit tracking system
  • 💰 Credit recharging via Hive, HBD, or btc lightning payments
  • 🆓 Free small credit topups for low balance users once every x hours (optional)
  • 🚫 Filter blacklisted words from prompts (optional)
  • 🎞️ Easily make gif animations from renders
  • 🖋️ Add text overlays for instant memes
  • 📅 Render prompt(s) by multiple schedules and deliver via webhooks
  • 🔧 Tweak menu for altering advanced settings on past renders
  • 🌅 Remove backgrounds from images automagically, export as transparent PNG
  • 🤖 Supports custom model/checkpoint files, and selecting what model to use per render
  • 🎭 Expanding, fading, inpainting and outpainting support
  • 😷 Mask an image with a text prompt for inpainting
  • ⚙️ Support for textual inversions, LORA & LYCORIS embeddings
  • Loads of commands for advanced features

Add arty to your discord server (easy)

🆕 Find arty in the application directory here

Or follow this direct invite link

Or come find arty in the support server

DiscordBanner

Once in your server you can right click him and "manage integrations" to choose what channels it should interact with

That's it! See the getting started guide - https://peakd.com/@ausbitbank/our-new-stable-diffusion-discord-bot

How to install and host for yourself

Click for installation instructions

Recommend at least 8gb video ram, lots of storage space, and joining the support server for help (see #bot-help)

Requirements:

  • InvokeAI v2.3.x installed and running on your system first
    • Ensure InvokeAI is running in browser-based UI mode
  • git
  • docker-compose

To download and configure the bot:

git clone https://github.com/ausbitbank/stable-diffusion-discord-bot
cd stable-diffusion-discord-bot
mv config.example config

Inside the docker-compose.yml file, check that the outputs volume maps correctly to your InvokeAI outputs folder.

volumes:
 - ~/invokeai/outputs:/app/outputs # change the left side of the colon (:) to your InvokeAI outputs folder on the host machine

Open the config\.env file in a text editor and configure at least the discordBotKey,adminID and channelID

To configure a new discord bot user and get the discordBotKey :

  • Visit discord.com/developers/applications
  • Click "New Application", give it a name, click bot > add bot
  • Copy the token into the .env file as discordBotKey
  • Enable Message Content Intent under Privileged Gateway Intent

Enable Message Content Intent

To collect the remaining adminID and channelID:

  • In discord to go User Settings > App Settings > Advanced > enable Developer Mode
  • For adminID, right click your own username and click "copy ID"
  • For channelID, right click your home/headquarters channel and click "copy ID"

After entering the required details, save the file and go back to your command prompt window and run:

docker-compose up

The bot will launch and you should see an invite link in the logs, control-click it to invite the bot to your server

The invite link will look like https://discord.com/oauth2/authorize?client_id= APPLICATION ID HERE &scope=bot&permissions=124992

That's it!

Screenshots

Click to view screenshots:

Tweak menu with advanced controls

Model/Checkpoint switching

Support for unlimited LORA's and textual inversions with paging menu

Expanding image transparency for outpainting

Outpainting a template image

Inpainting using a text mask

Automagic background removal

Slash commands with available parameters

Image from text with width/height parameters

Image from text with width/height parameters

Generating images from text + template

Generating images from text + templates

Seamless tiling background creation from a template

Seamless tiling background creation from a template

/prompt [keyword] to remix a random prompt from 600+ in the library so far

/prompt keyword to remix a random prompt (600+ so far)

Use {animal} {star} {city} etc in prompts to replace with random keywords from a text file library

Using an init image via discord message attachment

Recharging credit with Hive, HBD or BTC lightning

Generating animations with !meme animate and attaching images

Patches/Pull request are greatly appreciated!

If you have any questions you can find me (ausbitbank) in my discord here

You can test out the bot in any of the #artspam channels or by DM'ing

Star History

Star History Chart