web_app_tg_bot
Telegram bot that provides local and public IP addresses
Get your local and public IP addresses with web access URLs. Interactive inline keyboard navigation, simple and user-friendly interface.
web_app_tg_bot - a Telegram bot that provides local and public IP addresses with web access URLs. Interactive inline keyboard navigation, simple and user-friendly interface.
- ๐ Get local IP address - with port information
- ๐ Get public IP address - with port information
- ๐จ Interactive inline keyboard - easy navigation
- ๐ฑ Simple and user-friendly - intuitive interface
- โก Asynchronous operation - 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/aixandrolab/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.txt
Create a .env file in the root directory:
# 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
- 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
By using this software, you agree to the full disclaimer terms.
Software provided "AS IS" without warranty. You assume all risks.
Full legal disclaimer: See DISCLAIMER.md
License: BSD 3-Clause License