Skip to main content

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

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
MAX_COMMENT_MARKDOWN_CHARS 20000 Maximum characters to keep from comment markdown
COMMENTS_FETCH_CONCURRENCY 1 Max parallel comment fetches
ARTICLE_PIPELINE_CONCURRENCY 3 Max parallel article generation tasks
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

MIT

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

hnbot-0.0.2.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hnbot-0.0.2-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file hnbot-0.0.2.tar.gz.

File metadata

  • Download URL: hnbot-0.0.2.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","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

Hashes for hnbot-0.0.2.tar.gz
Algorithm Hash digest
SHA256 b690d20b183a0e5eefca02797ffae52fff9eb359993d054e2ad9a3a17a8f0bef
MD5 3ae2354bef0e948371f5a0484b9ed671
BLAKE2b-256 759f0e543ba93657e5f9caabae73f481542bacfdd5c9f28d120e2ee6bb8003a5

See more details on using hashes here.

File details

Details for the file hnbot-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: hnbot-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","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

Hashes for hnbot-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9a2a3eea333af9b56f9b33e869ee5d9ef36146a070aace448181bdb779be02ac
MD5 d1372fdd822bcf206fcbb61a28da376c
BLAKE2b-256 c6b30d90f95e219748cf03556ae76edadf6775636a2137c74182a8cfef70fc12

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page