No project description provided
Project description
Hacker News Bot
A Telegram bot that monitors Hacker News for trending articles, generates AI-powered summaries of the discussions, and delivers them straight to your Telegram chat.
Features
- RSS feed monitoring — fetches top stories from hnrss.org filtered by minimum points
- AI-powered summaries — uses OpenAI to distill HN comment threads into concise, structured articles
- Telegraph publishing — creates readable long-form pages on Telegraph
- Telegram notifications — sends formatted messages with links to the original article, HN discussion, and the generated summary
- Redis deduplication — tracks processed entries to avoid sending duplicate notifications
- Concurrent processing — handles multiple articles in parallel with configurable concurrency limits
- Retry with backoff — automatically retries transient HTTP failures
How It Works
hnrss.org RSS feed
│
▼
Filter by points
│
▼
Fetch HN comments ──► HTML → Markdown
│
▼
OpenAI summarisation
│
▼
Publish to Telegraph
│
▼
Notify via Telegram
Quick Start
Prerequisites
- Python 3.12+
- uv
- A Telegram Bot Token and a target chat ID
- An OpenAI API key
- A running Redis instance (for deduplication)
Install & Run
# Clone the repository
git clone https://github.com/narumiruna/hnbot.git
cd hnbot
# Install dependencies
uv sync
# Configure environment variables
cp .env.example .env
# Edit .env and fill in the required values
# Run the bot
uv run hnbot
Install from PyPI
pip install hnbot
Docker
docker build -t hnbot .
docker run --env-file .env hnbot
Configuration
All settings are loaded from environment variables (or a .env file). See .env.example for the full template.
Required
| Variable | Description |
|---|---|
OPENAI_API_KEY |
OpenAI API key |
BOT_TOKEN |
Telegram bot token |
CHAT_ID |
Telegram chat ID to receive notifications |
Optional
| Variable | Default | Description |
|---|---|---|
OPENAI_BASE_URL |
(OpenAI default) | Custom OpenAI-compatible API endpoint |
OPENAI_MODEL |
gpt-5-mini |
LLM model to use for summarisation |
LOGFIRE_TOKEN |
— | Logfire token for observability |
REDIS_HOST |
localhost |
Redis host |
REDIS_PORT |
6379 |
Redis port |
REDIS_DB |
0 |
Redis database number |
FEED_POINTS |
100 |
Minimum HN points threshold for feed entries |
HTTP_TIMEOUT_SECONDS |
10.0 |
HTTP request timeout (seconds) |
HTTP_USER_AGENT |
hnbot/0.0.0 |
HTTP User-Agent header |
COMMENTS_FETCH_CONCURRENCY |
1 |
Max parallel comment fetches |
ARTICLE_PIPELINE_CONCURRENCY |
3 |
Max parallel article generation tasks |
CHUNK_SIZE |
200000 |
Max characters per chunk for LLM processing |
BATCH_SLEEP_SECONDS |
0.5 |
Delay before processing a batch |
Development
# Install all dependencies (including dev)
uv sync
# Run the full development gate (format → lint → type-check → test)
just all
# Or run individual steps
just format # ruff format
just lint # ruff check --fix
just type # ty check
just test # pytest with coverage
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hnbot-0.0.3.tar.gz.
File metadata
- Download URL: hnbot-0.0.3.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d85790bfbb5bbacb2e17293b654ffbe30096358ec089d739cae3eb848ea4f5e5
|
|
| MD5 |
a18aa570e654e4aae5fde087a7e04007
|
|
| BLAKE2b-256 |
05f80fbf2324f22525e01feee21a929f0e1d409693e2279df2d0b0e0f4d7006f
|
File details
Details for the file hnbot-0.0.3-py3-none-any.whl.
File metadata
- Download URL: hnbot-0.0.3-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44ea8bbf613d99913c6a487672f2ca276679d8c6a15a95d7398753ad47648ce5
|
|
| MD5 |
2649cd35394d6e78a950209b00886050
|
|
| BLAKE2b-256 |
92621ad5bcd47f4f56ac601ff26a02bc1f642293e78adabec2d87665a8992380
|