Skip to content

Repository files navigation

diagram

Michelangelo
Telegram dating bot πŸ’ž

Hi, I made my own telegram dating bot, I hope it will be useful for someone. If you want to support me, you can put a star on the repository ; )

PythonAiogramPostgreSQLRedisLicense

screenshot 1


Navigation


Features

  • 🌍 Languages: Localization into different languages: English, Russian, Ukrainian, Spanish, French, Polish
  • πŸ’¬ Matchmaking: Helps users find each other based on shared interests.
  • πŸ”’ Secure: Implements secure data handling and user privacy.

Technical Features

  • 🌍 Geolocation: Uses Geopy to determine user locations.
  • πŸ“Š Analytics: Generates visual graphs with Matplotlib.
  • πŸ—‚οΈ Multilingual Support: Supports multiple languages via i18n.
  • ⚑ High Performance: Utilizes Redis for FSM storage and PostgreSQL for database operations.

Install

First you need to bend the repository to the correct derictory.

git clone https://github.com/devvsima/dating-bot.git
cd dating-bot

Settings

First, copy the .env.dist file and rename it to .env: Now you need to customize the .env file

Bot

NameDescriptionExample
TELEGRAM_BOT_TOKENBot Token from @BotFather1234567:ASDSFDkjdjdsedmD
SKIP_UPDATESSkip requests that were sent while the bot was not workingFalse
SET_COMMANDSSet commands when starting the botTrue
RATE_LIMITNumber of requests2
TIME_WINDOWTime interval between requests1
ADMINSList of administrator IDs separated by commas123456789, 987654321
BOT_CHANNEL_URL(Optional) The bot channel he will be sending tohttps://t.me/michalangelo_channel
MODERATOR_GROUP_ID(Optional) ID of the moderator group where complaints and notifications will be sent-100234567891
NEW_USER_ALET_TO_GROUP(Optional) Send notifications to the moderator groupTrue

Search

Configuring user profile search

SearchDescriptionExample
INITIAL_DISTANCEInitial search distance200.0
MAX_DISTANCEMaximum search distance1500.0
RADIUS_STEPDistance increase step200.0
MIN_PROFILESMinimum number of profiles for search100
BLOCK_SIZESize of profile batches in search (needed for randomizing profiles)15.0
AGE_RANGE_MULTIPLIERAge search multiplier (the older the person, the greater the age range)0.20
MIN_AGE_RANGEMinimum age difference2
MAX_AGE_RANGEMaximum age difference15

Database

If the settings for the database are not filled out, asynchronous Sqlite will be used. You can specify a link to the database connection in the DB_URL field.

NameDescriptionExample
DB_NAMEDatabase namemichalangelo
DB_HOSTDatabase hostlocalhost
DB_PORTDatabase port5432
DB_USERUser with Database permissionspostgres
DB_PASSPassword from userbestpass
DB_URL(Optional) Direct link, if specified, will be used as a prioritypostgresql+asyncpg://...@...
ECHOLogging of all SQL queriesFalse
POOL_SIZENumber of sessions12
MAX_OVERFLOWNumber of additional sessions18

Migrations

This project uses Alembic for database migrations.

  • Create a new migration:

    alembic revision --autogenerate -m "Migration description"
  • Apply migrations:

    alembic upgrade head # Apply all new migrations
    alembic upgrade "migration_name"# Apply a specific migration
  • Rollback migrations:

    alembic downgrade base # Reset database to the initial state
    alembic downgrade "migration_name"# Rollback to a specific migration

Ensure alembic.ini has the correct database URL before running migrations.

Redis

The radishes will be used as FSM storage. If redis is not connected the standard aiogram storage will be used. You can specify a link to the Redis connection in the RD_URL field at once.

NameDescriptionExample
REDIS_HOSTRedis hostlocalhost
REDIS_PORTRedis host6379
REDIS_PASS(Optional) Redis passwordbestpass
REDIS_DBDatabase number1
RD_URL(Optional) Direct link, if specified, will be used as a priorityredis://...@...

Localization

The bot has localization for 6 languages: en, ru, uk, fr, pl, es

  • Collecting all the texts from the project
pybabel extract --input-dirs=. -o locales/bot.pot --project=bot
  • Create files with translations into different languages
pybabel init -i locales/bot.pot -d locales -D bot -l en
pybabel init -i locales/bot.pot -d locales -D bot -l ru
pybabel init -i locales/bot.pot -d locales -D bot -l uk
pybabel init -i locales/bot.pot -d locales -D bot -l fr
pybabel init -i locales/bot.pot -d locales -D bot -l pl
pybabel init -i locales/bot.pot -d locales -D bot -l es
  • Once all the texts are translated, you need to compile all the translations
pybabel compile -d locales -D bot --statistics
pybabel update -i locales/bot.pot -d locales -D bot

Startup

First you need to install dependencies and do a database migration if you haven't already done one.

Windows

python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
python main.py

Linux

python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt
python main.py

πŸ’‘ You may have to install apt install python3.10-venv or something like that.

UV

uv sync
uv run main.py

License

This project is licensed under the Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) license. See the LICENSE file for details.

About

Telegram dating bot Michalangelo(Michi), an analog of Daivinchik(Leo). The bot is intended for making new acquaintances, including friendly ones.

Topics

Resources

Stars

44 stars

Watchers

3 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages