From 2d1bf99882681f83924badda5a28b82cb82c9560 Mon Sep 17 00:00:00 2001 From: git Date: Wed, 27 Aug 2025 11:55:29 +0100 Subject: [PATCH] Add README.md --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..6cc44d4 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# Telegram Bot Message Processor + +This repository provides a simple PHP + Makefile setup to **fetch Telegram updates** and **process incoming messages**. + +## Overview +- `process_message.php` – defines the function `process_message()` where you can add your own logic for handling incoming messages (sending replies, saving data, etc.). +- `Makefile` – automates fetching updates, processing them, and cleaning data files. +- `lib/main.php` – expected to contain helper functions like `telegram_send_text()` and `telegram_send_file()`. + +## How It Works +1. **Fetch updates** : calls the Telegram Bot API (getUpdates) and stores raw JSON messages in data/*.update_id.json. +```bash +make fetch_updates +``` +2. **Process updates** : each update is passed to process_message.php, where you can customize your bot’s behavior. +```bash +make process_updates +```` +3. **Clean data** : removes all program generated files +```bash +make clean +```` +--- +Requirements + • PHP CLI + • jq (for parsing JSON in make fetch_updates) + • curl \ No newline at end of file