A Python-based Telegram bot that provides real-time weather forecasts for any location. Users can get weather details for today, tomorrow, or the next 5 days. The bot supports location sharing and city name search, offering temperature, humidity, weather conditions, sunrise, and sunset times. Built using the PyTelegramBotAPI library and the OpenWeatherMap API, this bot is a comprehensive weather forecasting tool.
- Today's Weather: Get detailed weather information for the current day.
- Tomorrow's Weather: View weather predictions for the next day.
- 5-Day Forecast: Access a 5-day weather outlook.
- City Name Search: Search for weather by typing in a city name.
- Location Sharing: Share your location to get weather updates for your area.
- Temperature: Current and forecasted temperatures in Celsius.
- Humidity: Humidity levels for the selected location.
- Weather Conditions: Clear sky, rain, snow, thunderstorm, etc.
- Sunrise & Sunset Times: Accurate times for sunrise and sunset.
- Interactive Buttons: Easy navigation through button menus.
- Step-by-step Process: Guided weather forecast selection.
- Error Handling: Clear error messages and input validation.
- Back Navigation: Easy return to previous menus.
- Python 3.x
- PyTelegramBotAPI
- OpenWeatherMap API Key
- Datetime (for time calculations)
- Clone the repository
git clone https://github.com/GhostKX/Weather-Bot.git- Install required dependencies
pip install -r requirements.txt- Configure the bot
- Create a .env file to store your Telegram API Key and OpenWeatherMap API Key:
API_KEY=your-telegram-bot-token
API=your-openweathermap-api-key
- Navigate to the project directory
cd Weather-Bot- Run the bot
python PythonWeather_bot.py- Start the bot with
/start. - Choose an option:
- 🗺️ Search Location: Type in a city name.
- 📍 Share Location: Share your current location.
- Select the type of forecast:
- 📆 Today: Get today's weather.
- 📅 Tomorrow: Get tomorrow's weather.
- 🗓️ For 5 Days: Get a 5-day weather forecast.
- Temperature: Displayed in Celsius.
- Humidity: Shown as a percentage.
- Weather Conditions: Described with emojis and text.
- Sunrise & Sunset Times: Displayed in local time.
- Developed by GhostKX
- GitHub: GhostKX