This is a Telegram bot that generates cool looking avatars based on the name you enter. It uses the service from http://avatars.adorable.io/
to generate avatars.
- Welcomes users with a greeting message.
- Generates avatars based on user input.
- Sends avatars as photos in the chat.
- Sets up a webhook for Telegram updates.
- Python 3.12 or higher
- FastAPI
- Uvicorn
- python-telegram-bot
- pydantic-settings
-
Clone the repository:
git clone <repository-url> cd avatorbot
-
Install dependencies:
Use Poetry to install the required dependencies:
poetry install
-
Set up environment variables:
Create a
.env
file in the root directory and add the following variables:TELEGRAM_BOT_TOKEN=<your-telegram-bot-token> TELEGRAM_BOT_USERNAME=<your-telegram-bot-username> BASE_URL=<your-base-url>
Replace
<your-telegram-bot-token>
,<your-telegram-bot-username>
, and<your-base-url>
with your actual values.
-
Run the application:
Use Uvicorn to run the FastAPI application:
poetry run uvicorn main:app --reload
-
Set the webhook:
Access the
/setwebhook
endpoint to set up the webhook for Telegram updates:http://<your-base-url>/setwebhook
-
Interact with the bot:
Start a chat with your bot on Telegram and enter a name to receive an avatar.
Special thanks to Ali Abdel Aal
config.py
: Contains the configuration settings for the application using Pydantic.main.py
: The main application file that handles incoming Telegram messages and generates avatars.pyproject.toml
: Contains the project metadata and dependencies managed by Poetry..env
: Stores environment variables for sensitive information like the Telegram bot token.
This project is licensed under the MIT License.