Skip to content

avazcoderr/Gold-777-mebel-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gold-777-Mebel Bot 🤖

A Telegram bot for Gold-777-Mebel built with aiogram 3.22+.

Features

  • 🔐 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

Project Structure

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

Installation

  1. Clone the repository:
git clone <repository-url>
cd Gold-777-mebel-bot
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # Linux/Mac
# or
venv\Scripts\activate     # Windows
  1. Install dependencies:
pip install -r requirements.txt
  1. Create .env file:
cp .env.example .env
  1. Configure your environment variables in .env:
BOT_TOKEN=your_bot_token_here
DATABASE_URL=postgresql://user:password@localhost:5432/database_name

Database

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

Running the Bot

python main.py

Commands

  • /start - Start the bot and register
  • /login - Request a new OTP code

How It Works

  1. User sends /start
  2. Bot greets user and asks for contact
  3. User shares contact using the button
  4. Bot generates OTP and saves to database
  5. Bot sends OTP code to user
  6. User can use /login or inline button to renew code
  7. OTP expires after 1 minute

License

MIT License

About

Made for registration on the gold-777-mebel website

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors