Skip to content

About

A Telegram bot that provides local and public IP addresses with web access URLs.

Topics

Resources

Stars

5 stars

Watchers

2 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Telegram IP Address Bot v0.1.0

GitHub release (latest by date) GitHub top language GitHub GitHub stars GitHub forks


A Telegram bot that provides local and public IP addresses with web access URLs.


⚠️ Disclaimer

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


Features

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

Prerequisites

  • Python 3.8 or higher
  • Telegram Bot Token (from @BotFather)
  • Internet connection for public IP lookup

Installation

  1. Clone the repository
git clone https://github.com/yourusername/web_app_tg_bot.git
cd web_app_tg_bot
  1. Create and activate virtual environment
python -m venv venv
source venv/bin/activate
  1. Install dependencies
pip install -r requirements.txt

Environment Configuration

Create 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

Environment Variables Explanation

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 -

Project Structure

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

Usage

  1. Start the bot
python bot.py
  1. Interact with the bot on Telegram
    • Send /start command
    • 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

How It Works

  1. Local IP Detection: Uses UDP socket connection to 8.8.8.8 to determine the local network interface IP
  2. Public IP Detection: Fetches public IP from ipify.org API
  3. Bot Interface: Provides interactive buttons for easy navigation

Error Handling

  • Returns None if IP detection fails
  • Logs errors to console for debugging
  • Graceful failure without bot crashes

Security Considerations

  • ⚠️ 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.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Support

For issues, questions, or contributions:


Acknowledgments

About

A Telegram bot that provides local and public IP addresses with web access URLs.

Topics

Resources

Stars

5 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages