tg-news-bot
a feed reader that writes into a telegram channel instead of at me. sources
live in sources.yaml with a category each — it news, ambient music blogs,
games — and the bot walks them on a timer.
the interesting part isn't the fetching, it's the restraint. an aggregator with
no limits turns a channel into a firehose within a day, so most of the logic is
about holding back:
- three posts per run, thirty per rolling day, and at most two from any single
domain in twenty-four hours, so one busy blog can't take over the feed - a quiet window overnight — nothing gets posted between midnight and seven
- every entry is hashed and kept in sqlite, so the same story reappearing under
a different url doesn't go out twice
state lives in a sqlite file that survives restarts; delete it and the bot
forgets what it has already sent. async throughout — aiohttp for fetching,aiosqlite for the state — and it ships with a dockerfile and compose file,
because the whole point was to leave it running on a vps and not think about it.