Skip to main content

Droombot

Droombot is a discord bot for generating images from text prompts.

At current, it uses an API call to Stability.ai to generate images. A future version may support running Stable Diffusion directly.

https://user-images.githubusercontent.com/7782240/229916443-2cc0aa4d-188b-47c1-947e-9fd1708f4fba.mp4

Installing

:zap: Note: this step is not necessary if using a Container (see below)

Run the following, preferably in a virtual environment, to install droombot

pip install droombot

How to run

:zap: Note: this step is not necessary if using a Container (see below)

Configure your environment (see configuration options below), and make sure a redis instance is running on your network (we recommend using a container).

To start the bot, run the following in the virtual environment:

droombot server

To start a worker, run the following in the virtual environment

droombot worker

How to use in discord

Use the /prompt command to type your prompt. This by default uses whatever model Stability AI now considers its "core". You can also select Stable Diffusion 3 and Stable Diffusion 3 Turbo models by appending -m sd3 or -m sd3-turbo to your prompt.

You can give individual words in your prompt more some weight by doing something like the following; A table with (red:0.5) raspberries and (purple:0.5) blueberries.

Components

Droombot consists of two components:

  1. The server, this handles interaction with the user. I.e., it handles incoming prompts and replies. It provides the Discord bot users interact with.
  2. One or more workers. These handle the actual image generation.

Redis is used as a message broker between the server and the worker(s).

Configuration

All configuration is handled via environment variables. See the following table

Environment variable Description Is Required
DISCORD_BOT_TOKEN Token for your discord application Yes
DISCORD_GUILD_IDS Comma-separated list of guild (server) ids you want to allow access to the bot Yes
STABILITY_API_KEY API key from Stability AI Yes
REDIS_HOST Hostname of Redis instance No, defaults to localhost
REDIS_PORT Port of Redis instance No, defaults to 6379
REDIS_KEY_LIFETIME Number of seconds for keys to expire No, defaults to 300
MAX_REQUESTS_PER_MINUTE Maximum number of requests per minute to any remote services No, defaults to 100

Container

Droombot can run as a container. For a howto using Docker or Podman, see the container docs.

Future plans

  1. Expose additional options, such as multiple images and model selection.
  2. Ability to run Stable Diffusion directly, with a separate worker class
  3. Prompt translations, allowing users to use prompts in their own language.

Release files for droombot 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for droombot 0.2.0
File Size Uploaded
droombot-0.2.0.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for droombot 0.2.0
File Interpreter ABI Platform
droombot-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.5 kB

Release files / droombot-0.2.0.tar.gz

Download URL droombot-0.2.0.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
71fb557fe92ae66cc41d3006cdfaaf7016be043985c425a6f284c8e60258e46a
BLAKE2b-256 checksum
How to use checksums
7b5844719d3c488a73ddb07aa670a17501478cdeac99819a471d6578eb42430b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.6 Linux/5.15.0-107-generic

Release files / droombot-0.2.0-py3-none-any.whl

Download URL droombot-0.2.0-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4144b72184ce6fd984094060209e3431d5362cd2219792392ca7b1fc71e08bae
BLAKE2b-256 checksum
How to use checksums
e8f811a34d70ee95cd1638bb05cf7f693d3588c61e4b2d4f01fc5b2aee319aac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.6 Linux/5.15.0-107-generic

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page