A Telegram bot for Gold-777-Mebel built with aiogram 3.22+.
- 🔐 OTP code generation and management
- 📱 Contact sharing for user registration
- 🌐 Bilingual support (Uzbek 🇺🇿 / English 🇺🇸)
- 🗄️ PostgreSQL database integration (shared with Django project)
- ⏱️ 1-minute OTP expiration
Gold-777-mebel-bot/
├── bot/
│ ├── __init__.py
│ ├── config.py # Configuration settings
│ ├── database/
│ │ ├── __init__.py
│ │ ├── connection.py # Database connection pool
│ │ └── models.py # OTP manager
│ ├── handlers/
│ │ ├── __init__.py
│ │ ├── start.py # /start command
│ │ ├── contact.py # Contact handling
│ │ └── login.py # /login command & renew
│ └── keyboards/
│ ├── __init__.py
│ ├── reply.py # Reply keyboards
│ └── inline.py # Inline keyboards
├── main.py # Entry point
├── requirements.txt
├── .env.example
└── README.md
- Clone the repository:
git clone <repository-url>
cd Gold-777-mebel-bot- Create a virtual environment:
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
venv\Scripts\activate # Windows- Install dependencies:
pip install -r requirements.txt- Create
.envfile:
cp .env.example .env- Configure your environment variables in
.env:
BOT_TOKEN=your_bot_token_here
DATABASE_URL=postgresql://user:password@localhost:5432/database_name
This bot shares the same database with the Django project. The otp_codes table structure:
| Field | Type | Description |
|---|---|---|
| telegram_id | BigInteger | User's Telegram ID |
| phone_number | CharField(15) | Format: +998XXXXXXXXX |
| username | CharField(150) | Telegram username |
| full_name | CharField(500) | User's full name |
| code | CharField(6) | 6-digit OTP code |
| expiration_time | DateTimeField | OTP expiration timestamp |
python main.py/start- Start the bot and register/login- Request a new OTP code
- User sends
/start - Bot greets user and asks for contact
- User shares contact using the button
- Bot generates OTP and saves to database
- Bot sends OTP code to user
- User can use
/loginor inline button to renew code - OTP expires after 1 minute
MIT License