Documentation
Architecture
How Telegram messages move through shitpost, crosspost, and target platforms.
shitpost is intentionally thin. It owns the Telegram interface, local media download, environment normalization, and Telegram replies. Publishing is delegated to crosspost.
Telegram user
-> Telegram Bot API
-> shitpost Go process
-> crosspost CLI
-> Bluesky / Mastodon / X / other targets
Runtime pieces
| Piece | Responsibility |
|---|---|
| Telegram Bot API | Delivers messages, photos, videos, and documents to the bot. |
main.go | Polls updates, authorizes users, parses messages, downloads files, and starts crosspost. |
downloads/ | Local working directory for Telegram media files. |
crosspost CLI | Publishes to the selected social platforms. |
.env | Holds Telegram and platform credentials. |
| Docker image | Bundles the Go bot, Bun runtime, and built crosspost CLI. |
Message flow
- The bot starts and reads
BOT_TOKEN,AUTHORIZED_TELEGRAM_USERS,CROSSPOST_FLAGS, andSHITPOST_DRY_RUN. - The Telegram SDK opens a long-polling update channel.
- Non-message updates are ignored.
- If
AUTHORIZED_TELEGRAM_USERSis set, the sender username or numeric ID must match. - Text messages call
crosspostdirectly with the message body. - Photos are downloaded from Telegram, saved to
downloads/, and passed tocrosspostwith--image. - Captions ending with
alt:are split into clean caption and image alt text. - Videos and non-image documents are downloaded, but only caption text is posted by the current CLI path.
- The bot sends the captured
crosspostoutput back to the Telegram chat.
Docker build flow
The Dockerfile has two stages:
- A Go builder compiles the static
botbinary. - A Bun runtime clones
crosspost, installs dependencies, builds it, writes a/usr/local/bin/crosspostwrapper, and copies the Go binary.
The final container starts ./bot from /app and stores downloaded media in /app/downloads.
CI and releases
Pull requests and pushes run formatting, vet, build, and tests. Pushes to main also build multi-arch images for linux/amd64 and linux/arm64, sign them, publish to GHCR, and copy latest to Harbor.
Tags beginning with v run GoReleaser, publish release archives, build semver image tags, copy them to Harbor, and sign the images.
Security model
- The service is self-hosted; messages and downloaded media stay on your machine or server.
- No web UI is exposed by this project.
- The Telegram bot should be treated as a private command surface.
AUTHORIZED_TELEGRAM_USERSshould be set for any real account..envshould never be committed or shared.