Skip to content

ryuu000/stable-diffusion-discord-bot

 
 

Repository files navigation

stable-diffusion-discord-bot

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

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, Good Dollar or btc lightning payments
  • Free small credit topups for low balance users once every x hours (optional)
  • Filter blacklisted words from prompts (optional)
  • Remixing/meming and animating images using discord-image-generation
  • 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)

https://discord.com/application-directory/973484171534172170

Come find arty in the artspam room here https://discord.gg/DSdK9KRJxq Right click him, and click "add to server"

Once in your server you can right click him and "manage integrations" to chose 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

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

You'll need to have https://github.com/invoke-ai/InvokeAI installed and working on your system first, as well as nodejs and npm. Launch invokeai from its directory using invoke.bat (or invoke.sh on linux), and selecting option 2 for the browser based / web ui

To install bot dependancies : npm install or yarn install

If its a fresh install, rename the queue, payments and users db files to remove .example from the filename, eg dbPayments.json.example to dbPayments.json

Rename .env.example to .env and enter your own details:

  • Copy the Discord channel ID as channelID
    • User Settings > ᴀᴘᴘ sᴇᴛᴛɪɴɢs > Advanced > enable Developer Mode per D⁽ˀ⁾
    • Right click Channel, Copy ID
  • adminID is your full Discord username#123
  • apiURL is already the default for https://github.com/lstein/stable-diffusion
  • Copy Bot ᴛᴏᴋᴇɴ as discordBotKey
    • New Application
    • Settings > Bot > Add Bot
    • (If necessary: Reset Token), Copy
    • Enable the ᴍᴇssᴀɢᴇ ᴄᴏɴᴛᴇɴᴛ ɪɴᴛᴇɴᴛ Privileged Gateway Intent per @zsoltime on SO.
      • image

Run with npm start or yarn start

Invite to your server with https://discord.com/oauth2/authorize?client_id= APPLICATION ID HERE &scope=bot&permissions=124992 (these ᴛᴇxᴛ ᴘᴇʀᴍɪssɪᴏɴs are required for the bot to function!)

If you get a disallowed intents specified error on first launch, make sure you have "Message Content" privileged intent enabled in your bots settings here

https://discord.com/developers/applications/

The background removal feature requires you to run a "rembg" server bound to localhost port 5000 You can start it as a docker container with this command docker run -p 127.0.0.1:5000:5000 danielgatis/rembg s

Screenshots:

Tweak menu with advanced controls

Model/Checkpoint switching

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 - https://discord.gg/DSdK9KRJxq You can test out the bot in the #artspam channel

discord license

Star History

Star History Chart

About

dicord bot generative A.I

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%