{"id":25001498,"url":"https://github.com/mansionnet/weatherbot","last_synced_at":"2026-02-07T11:32:27.779Z","repository":{"id":270611639,"uuid":"910914417","full_name":"MansionNET/WeatherBot","owner":"MansionNET","description":"A lightweight IRC bot that provides real-time weather information using the Open-Meteo API. WeatherBot is designed to be simple to set up, easy to configure, and free to use as it relies on the free Open-Meteo API service.","archived":false,"fork":false,"pushed_at":"2025-01-25T00:32:20.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-03T08:08:06.006Z","etag":null,"topics":["irc","irc-bot","metheorology","open-meteo","python","weather","weather-api","weather-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MansionNET.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-01T19:16:38.000Z","updated_at":"2025-01-25T00:32:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"79245a73-01c6-4cb8-81c3-a93e5d22ce2d","html_url":"https://github.com/MansionNET/WeatherBot","commit_stats":null,"previous_names":["mansionnet/weatherbot"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/MansionNET/WeatherBot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MansionNET%2FWeatherBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MansionNET%2FWeatherBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MansionNET%2FWeatherBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MansionNET%2FWeatherBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MansionNET","download_url":"https://codeload.github.com/MansionNET/WeatherBot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MansionNET%2FWeatherBot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29193588,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["irc","irc-bot","metheorology","open-meteo","python","weather","weather-api","weather-bot"],"created_at":"2025-02-04T20:35:22.558Z","updated_at":"2026-02-07T11:32:27.773Z","avatar_url":"https://github.com/MansionNET.png","language":"Python","readme":"# MansionNet Weather Bot\n\nA lightweight, reliable IRC bot that provides real-time weather information using the Open-Meteo API. Designed for 24/7 operation with robust error handling and efficient resource usage.\n\n## Features\n\n- Real-time weather data from Open-Meteo API (no API key required)\n- Global city search with geocoding\n- Colorized IRC output with weather icons\n- SSL/TLS support for secure connections\n- Automatic reconnection with exponential backoff\n- Efficient resource usage with proper timeout handling\n- Production-tested for 24/7 stability\n\n## Weather Information Provided\n\n- Current temperature (°C)\n- Weather conditions (clear, cloudy, rain, snow, thunderstorm, etc.)\n- Relative humidity (%)\n- Wind speed (km/h)\n\n## Commands\n\n- `!weather \u003ccity\u003e` - Get current weather for any city worldwide\n  - Example: `!weather Belgrade`\n  - Example: `!weather New York`\n- `!help` - Display bot help information\n\n## Requirements\n\n- Python 3.7+\n- `requests` library\n\n## Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/MansionNET/weatherbot.git\ncd weatherbot\n```\n\n2. Install dependencies:\n```bash\npip install requests\n```\n\n3. Configure the bot:\nEdit `weatherbot.py` and update:\n```python\nself.server = \"your.irc.server.com\"\nself.port = 6697  # or 6667 for non-SSL\nself.nickname = \"WeatherBot\"\nself.channels = [\"#channel1\", \"#channel2\"]\n```\n\n4. (Optional) For NickServ authentication, add:\n```python\nself.password = \"your_nickserv_password\"\n```\n\nAnd uncomment the NickServ identification lines in the `connect()` method.\n\n## Running the Bot\n\n### Manual Start\n```bash\npython3 weatherbot.py\n```\n\n### As a systemd Service (Linux)\n\n1. Create service file `/etc/systemd/system/weatherbot.service`:\n```ini\n[Unit]\nDescription=MansionNet Weather Bot\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nType=simple\nUser=youruser\nWorkingDirectory=/path/to/weatherbot\nExecStart=/usr/bin/python3 /path/to/weatherbot/weatherbot.py\nRestart=always\nRestartSec=30\n\n[Install]\nWantedBy=multi-user.target\n```\n\n2. Enable and start:\n```bash\nsudo systemctl enable weatherbot.service\nsudo systemctl start weatherbot.service\n```\n\n3. Check status:\n```bash\nsudo systemctl status weatherbot.service\n```\n\n## Configuration Options\n\n### SSL/TLS\nThe bot uses SSL by default. To disable certificate verification (for self-signed certs):\n```python\nself.ssl_context.check_hostname = False\nself.ssl_context.verify_mode = ssl.CERT_NONE\n```\n\n### Connection Timeouts\n- Socket timeout: 1.0 second (prevents blocking)\n- API request timeout: 5 seconds (for geocoding and weather data)\n- Reconnection delay: 30 seconds (after errors)\n\n### Customization\n- **Colors**: Modify the `TEXT` variable in `get_weather()` for different IRC color codes\n- **Weather Icons**: Customize the symbols (▸, ❋, ⟳) in the return string\n- **Channels**: Add or remove channels in the `self.channels` list\n\n## API Information\n\nThis bot uses the free [Open-Meteo API](https://open-meteo.com/):\n- No API key required\n- No rate limiting for reasonable use\n- Global coverage\n- Real-time data updates\n\nGeocoding provided by Open-Meteo's geocoding API.\n\n## Architecture\n\n### Connection Management\n- Non-blocking socket operations with timeout\n- Automatic reconnection on connection loss\n- Proper handling of IRC PING/PONG\n- Buffer management for split messages\n\n### Error Handling\n- Graceful handling of network timeouts\n- Unicode decode error recovery\n- API request failure fallbacks\n- Connection closed detection\n\n### Resource Efficiency\n- Sleep intervals during idle periods (0.1s when no data)\n- Socket timeouts prevent CPU spinning\n- Efficient buffer processing\n- Minimal memory footprint\n\n## Troubleshooting\n\n### Bot not connecting\n- Check IRC server address and port\n- Verify SSL/TLS requirements\n- Check firewall rules for outbound connections\n\n### Bot joins but doesn't respond\n- Verify the bot is in the correct channels\n- Check channel permissions (some channels may be +m or require voice)\n- Review logs for error messages\n\n### High CPU usage\n- Ensure you're running the latest version with timeout fixes\n- Check network stability\n- Monitor system logs for connection issues\n\n### Weather data not updating\n- Verify internet connectivity\n- Check if Open-Meteo API is accessible\n- Ensure DNS resolution is working\n\n## Production Deployment\n\n### Security Considerations\n- Store NickServ passwords in environment variables or secrets management\n- Use SSL/TLS for IRC connections when available\n- Run the bot as a non-privileged user\n- Monitor logs for unusual activity\n\n### Monitoring\n- Use systemd status to check bot health\n- Monitor CPU and memory usage\n- Set up log rotation for long-term operation\n- Consider external monitoring for uptime\n\n## Example Usage\n```\n\u003cuser\u003e !weather London\n\u003cWeatherBot\u003e London, United Kingdom 【Partly cloudy】 ▸ 12°C ❋ 78% ⟳ 15 km/h\n\n\u003cuser\u003e !weather Tokyo\n\u003cWeatherBot\u003e Tokyo, Japan 【Clear sky】 ▸ 18°C ❋ 45% ⟳ 8 km/h\n\n\u003cuser\u003e !weather Belgrade\n\u003cWeatherBot\u003e Belgrade, Serbia 【Overcast】 ▸ 5°C ❋ 82% ⟳ 12 km/h\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues or pull requests.\n\n### Development Guidelines\n- Follow PEP 8 style guidelines\n- Add comments for complex logic\n- Test thoroughly before submitting PRs\n- Update README for new features\n\n## License\n\n[Your chosen license - e.g., MIT, GPL, etc.]\n\n## Acknowledgments\n\n- Weather data provided by [Open-Meteo](https://open-meteo.com/)\n- Built for the MansionNET IRC community\n- Inspired by classic IRC bots and modern Python practices\n\n## Changelog\n\n### v2.0 (2026-01-26)\n- **Fixed:** Critical CPU spinning bug in main message loop\n- **Added:** Socket timeout handling for non-blocking operations\n- **Added:** API request timeouts (5 seconds)\n- **Improved:** Connection error handling and reconnection logic\n- **Improved:** Resource efficiency and stability for 24/7 operation\n\n### v1.0 (Initial Release)\n- Basic weather information functionality\n- Multi-channel support\n- IRC color formatting\n- Open-Meteo API integration\n\n## Support\n\nFor issues, questions, or suggestions:\n- Open an issue on GitHub\n- Contact on IRC: #lobby on irc.inthemansion.com port: 6697 or https://webirc.inthemansion.com/\n\n---\n\nMade with ☕ for the MansionNET community\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmansionnet%2Fweatherbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmansionnet%2Fweatherbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmansionnet%2Fweatherbot/lists"}