2025-08-27 11:55:29 +01:00

27 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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 bots 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