conaobiad

Keep a list of meal ideas and pick one at random, on the web or in Telegram.

For when nobody can decide what's for dinner.

HobbiesTelegram bot, Web appRust, Solid, TypeScriptMIT

What it is

"Co na obiad?" is Polish for "what's for dinner?". The bot stores entries, meal ideas in practice, and picks one at random so nobody has to decide. It is a Telegram bot and a web UI over the same list.

Everything ships as one binary: the Rust server embeds the compiled Solid frontend and serves it over HTTP next to the Telegram bot. cargo build runs npm ci and npm run build in web/ and embeds web/dist, so no static files are needed at runtime.

What it does

WhereWhat
Bot/random, /list <page> (20 per page), /pick <n>; admins /add, /remove <n>, /add_admin <username>
Web: Picka random meal (Space picks again), or entry n; numbers match the bot's /pick n
Web: Listall entries with search; admins add, edit and remove
Web: Databasebrowse the entries and admins tables with schema, filter, sort and paging

Web changes need the admin key: set WEB_ADMIN_TOKEN, or the server generates one at startup and prints it to stderr. Telegram admins only apply to the bot. GET /healthz returns the entry count; the JSON API lives under /api.

Run

cargo build --release
export TELOXIDE_TOKEN="<your-bot-token>"   # optional: without it only the web UI runs
export WEB_ADMIN_TOKEN="<a-long-secret>"   # optional
./target/release/co-na-obiad-bot

The binary reads and writes ./data relative to its working directory; entries.txt and admins.txt seed local.db. The web UI is on port 3000 unless HTTP_PORT says otherwise.