A Telegram bot that provides local and public IP addresses with web access URLs.
By using this software, you agree to the full disclaimer terms.
Summary: Software provided "AS IS" without warranty. You assume all risks.
Full legal disclaimer: See DISCLAIMER.md
- 🔍 Get local IP address with port information
- 🌐 Get public IP address with port information
- 🎨 Interactive inline keyboard navigation
- 📱 Simple and user-friendly interface
- ⚡ Asynchronous operation for better performance
- Python 3.8 or higher
- Telegram Bot Token (from @BotFather)
- Internet connection for public IP lookup
- Clone the repository
git clone https://github.com/yourusername/web_app_tg_bot.git
cd web_app_tg_bot- Create and activate virtual environment
python -m venv venv
source venv/bin/activate- Install dependencies
pip install -r requirements.txtCreate a .env file in the root directory with the following variables:
# Telegram Bot Token (required)
TOKEN=your_telegram_bot_token_here
# Application Settings
PORT=8000
WEB_APP_TITLE=🌐 IP Address Bot
WEB_APP_DESCRIPTION=Get your local and public IP addresses with web access URLs| Variable | Description | Required | Default |
|---|---|---|---|
TOKEN |
Telegram Bot API token from @BotFather | Yes | - |
PORT |
Port number for web access URLs | No | 8000 |
WEB_APP_TITLE |
Title displayed in bot messages | No | "🌐 IP Address Bot" |
WEB_APP_DESCRIPTION |
Description text in welcome message | No | - |
web_app_tg_bot/
├── .env # Environment variables
├── .gitignore # Git ignore file
├── bot.py # Main bot application
├── utils/
│ └── get_ip.py # IP address utilities
├── requirements.txt # Python dependencies
└── README.md # Documentation
- Start the bot
python bot.py- Interact with the bot on Telegram
- Send
/startcommand - Click "Get local IP-url" to see your local IP
- Click "Get public IP-url" to see your public IP
- Use "⬅ Back" button to return to main menu
- Send
- Local IP Detection: Uses UDP socket connection to 8.8.8.8 to determine the local network interface IP
- Public IP Detection: Fetches public IP from ipify.org API
- Bot Interface: Provides interactive buttons for easy navigation
- Returns
Noneif IP detection fails - Logs errors to console for debugging
- Graceful failure without bot crashes
⚠️ Exposing local IP addresses can be a security risk- Recommended for internal network use only
- Don't expose this bot to public if local IP contains sensitive information
- Consider adding authentication for production use
Copyright © 2026 Alexander Suvorov. All rights reserved.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
For issues, questions, or contributions:
- aiogram - Telegram Bot API framework
- @BotFather - Telegram bot registration