TwitX
A drafting helper for tech posts. Twice a day it pulls what's trending on Reddit, Hacker News and GitHub, writes drafts in the user's own style, and sends them on Telegram for review. It never posts by itself.
Overview
Posting regularly about tech takes a lot of time just to find topics. TwitX runs a pipeline twice a day. It scrapes Reddit, Hacker News and GitHub, keeps what matches each user's topics, and asks an LLM to write drafts using that user's past posts as style examples. The drafts arrive on Telegram and the user decides what to post. It never posts on its own.
Problem
Finding topics and writing drafts every day takes too much time. The goal was help with drafting, not a bot that posts for you.
Approach
A simple relevance score cuts the scraped items down to the top 15 before anything goes to the LLM. The prompt includes the user's past posts and which drafts they liked or skipped. GitHub Actions runs the pipeline on a schedule, so no server has to run all day.
Architecture / how it works
- Relevance = keyword hits × 10 + log(upvotes + 1) × 5. The top 15 go to the LLM, which keeps the prompt small.
- On Vercel the function gets killed as soon as the HTTP response is sent, which would drop Telegram replies. A custom
dispatchUpdateawaits every bot handler before responding. parseDraftstries to parse the full JSON array first. If the model got cut off bymax_tokens, it rescues whatever complete{}objects it can find.- It uses Groq by default, but any OpenAI-compatible provider works by setting
AI_BASE_URL/AI_MODEL, with no code changes. - A GitHub Actions cron (09:00 and 19:00 UTC) runs the pipeline, which gets around Vercel's short function timeout.
Tech stack
Outcomes
The pipeline works end to end with Telegram. Discord delivery isn't implemented yet (it's just a stub).