/stable-diffusion-discord-bot

Primary LanguageJavaScriptThe UnlicenseUnlicense

stable-diffusion-discord-bot

A discord bot built to interface with the webserver api built into the invoke-ai fork of stable-diffusion.

Current features:

  • Most features from the lstein fork 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
  • Prompt and keyword randomisation from txt files
  • 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)
  • Upload to imgur api if files get too big for your discord server (optional)
  • Upload to imgbb api (optional)
  • Remixing/meming and animating images using discord-image-generation
  • Render prompt(s) by multiple schedules and deliver via webhooks

WIP/future features:

  • Alternative render path via dreamstudio api for paying users

Screenshots:

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

Add arty to your discord server (easy)

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 with python scripts\dream.py --web to launch the api server for the bot.

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!)

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