This project implements an AI-powered Discord bot capable of generating images and text based on user input. It utilizes a job queue system to manage and process image and text generation requests asynchronously. The bot is built using the Discord.py library and communicates with separate AI models for image and text generation.
Here's a demonstration of the bot in action:
- The main entry point of the application is
main.py
. This file initializes the custom Discord client, sets up logging, and starts the job queue thread. - The custom Discord client is defined in
client.py
. It is responsible for handling interactions and managing the command tree. - The bot uses a job queue system to manage requests. This is implemented in
job_handler.py
. The job queue runs in a separate thread and processes jobs asynchronously. - Image and text generation commands are defined in
commands/img.py
andcommands/txt.py
, respectively. Each command is a function that takes user input and adds a job to the job queue. - The bot uses separate AI models for image and text generation. The models are hosted on external servers and are accessed via HTTP requests.
- Configuration parameters for the bot and AI models are stored in
config.py
.
- Install the required Python packages using
pip install -r requirements.txt
. - Set up the environment variables:
DISCORD_BOT_TOKEN
: Your Discord bot tokenDISCORD_GUILD_ID
: The ID of the guild (server) where your bot will be deployed
- Run the bot using
python main.py
.
Once the bot is running, you can use the following commands in your Discord server:
/img
: Generates an image based on the provided prompt and optional parameters./txt
: Generates text based on the provided prompt and optional parameters.
Please refer to the command descriptions for more information on the available parameters and their usage.
If you'd like to contribute to this project, please create a fork and submit a pull request with your changes. Make sure to follow the existing code style and include relevant documentation.
This project is licensed under the MIT License. See the LICENSE file for more information.