This is a Discord bot that analyzes image metadata generated by various Stable Diffusion tools. It is based on the Stable Diffusion Prompt Reader project by receyuki.
- Analyzes image metadata from various Stable Diffusion tools, including A1111 webUI, Easy Diffusion, InvokeAI, NovelAI, ComfyUI, Draw Things, StableSwarmUI, and Fooocus.
- Monitors all channels in a Discord server for images by default.
- Allows administrators to exclude specific channels from image analysis using the
!excludecommand. - Reacts with a magnifying glass emoji (🔍) to images with recognized metadata.
- Reacts with an envelope emoji (✉️) to images without recognized metadata.
- Sends a direct message to users who react with the magnifying glass emoji, providing the image metadata, including the prompt, negative prompt, settings, and parameters.
- Sends a direct message to users who react with the envelope emoji, providing the image URL and a link to the original message.
- Supports multi-image messages and includes image index and total count in the metadata.
- Implements a cooldown mechanism to prevent spamming of reactions.
- Allows users to delete messages sent by the bot in their DMs by reacting with the ❌ emoji.
- Python 3.7 or higher
discordlibrary
-
Clone this repository or download the source code.
-
Install the required
discordlibrary using pip:pip install discord -
Create a new file named
bot_token.txtin the same directory as thediscord_bot.pyfile. -
Open the
bot_token.txtfile and paste your Discord bot token as the only content in the file.
-
Run the
discord_bot.pyscript:python discord_bot.py -
The bot will log in and display a message indicating that it's ready. Press Ctrl+C to stop the bot.
-
The bot will monitor all channels in the server for images by default.
-
To exclude a channel from image analysis, use the
!excludecommand in that channel. Only administrators can use this command. -
To include a previously excluded channel, use the
!includecommand in that channel. Only administrators can use this command. -
When an image with recognized metadata is posted, the bot will react with a magnifying glass emoji (🔍).
-
When an image without recognized metadata is posted, the bot will react with an envelope emoji (✉️).
-
Users can react to the image with the corresponding emoji to receive a direct message containing the image metadata or image URL and original message link.
-
To delete a message sent by the bot in a DM, users can react to the message with the ❌ emoji.
-
The bot prefix is set to
!. You can change it by modifying thecommand_prefixparameter in thediscord_bot.pyfile. -
The cooldown duration for reactions is set to 5 minutes. You can adjust it by modifying the
timedelta(minutes=5)line in thediscord_bot.pyfile.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License.
- receyuki for creating the Stable Diffusion Prompt Reader project.
- The developers of the various Stable Diffusion tools supported by this bot.
If you have any questions or need further assistance, please feel free to create an issue.