No description
  • C 47.3%
  • Rust 30.1%
  • CMake 12.2%
  • Shell 9.8%
  • Just 0.6%
Find a file
Mert Sefa AKGUN e5d22025aa
All checks were successful
CI / build-test (push) Successful in 2m52s
Initial commit
2026-05-28 16:33:47 +03:00
.github/workflows Initial commit 2026-05-28 16:33:47 +03:00
docs Initial commit 2026-05-28 16:33:47 +03:00
include Initial commit 2026-05-28 16:33:47 +03:00
scripts Initial commit 2026-05-28 16:33:47 +03:00
src Initial commit 2026-05-28 16:33:47 +03:00
tests Initial commit 2026-05-28 16:33:47 +03:00
.env.example Initial commit 2026-05-28 16:33:47 +03:00
.gitignore Initial commit 2026-05-28 16:33:47 +03:00
Cargo.lock Initial commit 2026-05-28 16:33:47 +03:00
Cargo.toml Initial commit 2026-05-28 16:33:47 +03:00
CMakeLists.txt Initial commit 2026-05-28 16:33:47 +03:00
justfile Initial commit 2026-05-28 16:33:47 +03:00
README.md Initial commit 2026-05-28 16:33:47 +03:00

NXLog Weather Bot

WeatherService Telegram bot implementation for the NXLog task. The Linux bot host is written in C with telebot and APR; weather lookup is implemented in Rust and called from C through a small FFI boundary.

Features

  • Telegram long-polling bot using smartnode/telebot.
  • Rust Open-Meteo integration using openmeteo-rs.
  • City lookup through Open-Meteo geocoding.
  • GPS coordinate lookup in the task's longitude, latitude order.
  • Meaningful user-facing errors for malformed input, unknown locations, and upstream failures.
  • APR-backed in-memory cache for successful weather responses.
  • CMake top-level build, Rust/C unit tests, and GitHub Actions CI.

Linux Dependencies

On Ubuntu/Debian:

sudo apt-get update
sudo apt-get install -y build-essential cmake git libapr1-dev libcurl4-openssl-dev libjson-c-dev pkg-config

Install Rust 1.95 or newer. The current openmeteo-rs crate requires Rust 1.95.

Install telebot:

git clone --depth 1 --branch v9.4 https://github.com/smartnode/telebot.git /tmp/telebot
cmake -S /tmp/telebot -B /tmp/telebot/build -DCMAKE_INSTALL_PREFIX=/tmp/telebot-prefix
cmake --build /tmp/telebot/build --parallel
cmake --install /tmp/telebot/build
export PKG_CONFIG_PATH=/tmp/telebot-prefix/lib/pkgconfig:$PKG_CONFIG_PATH

Build And Test

cargo test
cmake -S . -B build
cmake --build build --parallel
ctest --test-dir build --output-on-failure

If you only want to run the local C tests on a machine without telebot or json-c installed:

cmake -S . -B build -DWEATHERBOT_BUILD_BOT=OFF
cmake --build build --parallel
ctest --test-dir build --output-on-failure

Run

Do not put real tokens in the repository. Export the token at runtime:

export TELEGRAM_BOT_TOKEN="123456789:replace-me"
export WEATHERBOT_CACHE_TTL_SECONDS=300
./build/weatherbot

Supported messages:

/weather Berlin
/weather 13.4105, 52.5244
/weather lat=52.5244 lon=13.4105
Berlin

Unlabeled coordinates follow the task document's longitude, latitude order. Bot responses include current temperature, returned coordinates, and Open-Meteo attribution.