Thanks to visit codestin.com
Credit goes to github.com

Skip to content

SuikoHero38/personal-ops

Repository files navigation

Personal Ops — Weather Bot (Telegram)

A lightweight personal Telegram bot that replies with an hourly weather report for a default city or a user-provided city.

The command keyword is cuaca (Indonesian for “weather”).

Features

  • Hourly forecast: temperature, “feels like”, humidity, wind speed + gusts, precipitation probability + amount
  • Human-friendly summary: simple warnings and clothing tips based on conditions
  • Default city configuration via environment variables
  • Optional city override and optional horizon (e.g., 12h, 24h, up to a safe max)
  • Geocoding cache (SQLite) to reduce repeated geocoding requests

Example Commands

  • cuaca → weather for the default city (default horizon)
  • cuaca 24h → weather for the default city for 24 hours
  • cuaca Berlin → weather for Berlin
  • cuaca Hamburg 12h → weather for Hamburg for 12 hours

Tech Stack

  • Python
  • Docker + Docker Compose
  • Telegram Bot API (polling)
  • Open-Meteo (forecast provider)
  • Nominatim / OpenStreetMap (geocoding)
  • SQLite (local cache)

How It Works

  1. Command parsing: detect cuaca, parse optional city and optional horizon (e.g., 24h)
  2. Geocoding: convert city name to latitude/longitude (cached in SQLite)
  3. Forecast retrieval: fetch hourly forecast from Open-Meteo
  4. Formatting: generate a compact summary + hourly lines
  5. Delivery: send a reply message via Telegram

Running Locally (Docker)

cuaca means “weather”.

Prerequisites

  • Docker Desktop (macOS/Windows) or Docker Engine (Linux)
  • A Telegram bot token from @BotFather

Setup

  1. Create a .env file (do not commit it) based on .env.example:
  • TELEGRAM_BOT_TOKEN=...
  • DEFAULT_CITY=Berlin
  • TZ=Europe/Berlin
  1. Start the bot:
docker compose up -d
docker compose logs -f
  1. Chat your bot on Telegram:
  • cuaca
  • cuaca Berlin 12h

Stop

  • docker compose down

Configuration

Environment variables (see .env.example):

  • TELEGRAM_BOT_TOKEN (required)
  • DEFAULT_CITY (default: Berlin)
  • TZ (default: Europe/Berlin)
  • SQLITE_PATH (default: /data/personal_ops.sqlite)

Security Notes

  • Never commit .env or any tokens/keys.
  • Rotate the Telegram bot token immediately if it is exposed.
  • Polling mode requires no inbound ports, which reduces attack surface.
  • The SQLite database is used only for caching geocoding results and should not be committed.

Documentation

  • Architecture: docs/architecture.md
  • Security & privacy: docs/security.md

Troubleshooting

  • If the bot does not reply, check logs:
    • docker compose logs -f
  • If Docker cannot connect to the daemon on macOS, ensure Docker Desktop is running.
  • If geocoding fails for a city name, try a more specific query (e.g., cuaca Munich, Germany).

Roadmap

  • Export a “full report” as PDF/Markdown artifacts
  • Optional Google Drive upload for daily artifacts
  • Expenses module (chat → Google Sheets)
  • Research Radar module (daily paper digest)
  • Personal web dashboard integrating all modules

License

Choose a license that fits your needs (MIT is common for portfolio projects).

About

Personal-ops repo for everyday helpers, beginning with a lightweight weather bot for quick local forecasts.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages