DnD Fantasy Character Generator Telegram Bot
This project is a Telegram bot that allows users to create custom fantasy Dungeons & Dragons characters. Users can select parameters for their character through a menu and upload their face to be placed on the generated character image.
- Menu-driven character creation
- Customizable parameters: race, class, hair, beard, gender, background
- Face swapping: upload your face to be placed on the generated character
- Generated images in a photorealistic, fantasy art style
- Python 3.8+
- Poetry for dependency management
- SQL db
- Insightface models
- Telegram Bot API token
-
Clone the repository:
git clone https://github.com/Dimildizio/mask_of_many_faces.git cd mask_of_many_faces
-
Install dependencies:
poetry install
-
Set up a config:
Create a config
.yaml
file in the projectsrc/utilities
and add your variables:swapper: your fastapi face swapper address gen_url: your image generation model url gen_model: type of the model gen_width: widths gen_height: heights gen_steps: steps of generation from 1 to 100 gen_api: api for generation model gen_folder: where to save generations tg_token: telemgram token face_folder: where to save downloaded images db_name: database name db_type: type of database
-
Run the bot:
poetry run python main.py
- /start: Initialize the bot and create user data in the database.
- /help: Display help message.
- /contacts: Get contact information.
- /menu: Display the character creation menu.
- /character: Show current character details.
- /generate: Generate a character image based on selected parameters.
- Photo upload: Upload a photo to use your face on the generated character.
-
Main Menu: Select from the following categories:
- Race
- Class
- Hair
- Beard
- Gender
- Background
-
Subcategories: Choose specific options within each category.
-
Back Button: Navigate back to the main menu from any subcategory.
-
Genration Process:
Here is an example of generation and swap with given parameters:
- Race: dwarf
- Class: artificer
- Hair: blonde
- Beard: yes
- Background: ship
-
More examples:
prompt -> generated image -> source face -> result
src
: folder for project python filesmain.py
: Entry point for the bot.tg_bot/
: Telegram bot related handlers and logic.database/
: Database models and operations.generation/
: Logic for generating character images.swapper/
: Logic for face swapping in images.utilities/
: Constants and helper functions.
tests
: folder for testsdocs
: folder for docs
Feel free to submit issues or pull requests if you find any bugs or have suggestions for improvements.
This project is licensed under the MIT License.