Media
Media
A buy post carries either one fixed picture or a fresh pick from a linked gallery site on every buy. The imageMode field ("fixed" / "random") decides which.
Fixed vs random gallery image
The two imageMode values
| Setting | Value |
|---|---|
fixed (default) | Every buy carries the same imageUrl / mediaType. |
random | Every buy carries a fresh picture pulled from the bot's linked gallery site(s). |
Set from the dashboard's Layout settings (buttons Fixed image / Random gallery image — a draft-state change, applied on the next Save & Push, like every other layout field) or from an admin-only gallery-site panel (buttons fixed image / random image, same field, written immediately on click). Every in-chat media write that follows a confirmed switch also sets it — see Which paths can drop random mode, below.
Its images are whatever that site lists — the site's images directory walked recursively, 4 levels deep, dot-entries skipped, extensions .jpg.jpeg.png.gif.webp.avif. A bot with more than one linked gallery draws from all of them. A generation that lands in a linked site's collection becomes eligible the moment the pool next refills.
Note
No gallery linked while random mode is on: the settings card reads
Buy media: random gallery image is on, but no gallery site is linked to this bot — the fixed <image/GIF/video> is used, or ends— posts go without mediainstead, when there's no fixed media either. Buys still post; they fall back to the fixed slot.
The ready pool
Telegram can't take AVIF, and every gallery collection is AVIF, so pictures are converted to JPEG ahead of time — never on the buy's own critical path.
Pool parameters
| Setting | Value |
|---|---|
| Target size | 16 ready files |
| Refill trigger | A background refill starts whenever the pool drops below 8 |
| JPEG quality | 95 |
| Ready-file TTL | 3600 seconds (1 hour) — an older file is discarded unsent, so a quiet bot still picks up new generations within the hour |
| Gallery walk depth | 4 directory levels |
An empty pool on a buy (a burst that outran the refill) converts one image inline instead, so the buy still ships with a gallery picture. If that also fails, the buy falls back to the fixed image, or to text alone — a buy is never dropped for a media failure.
The pool is deleted whole the moment the mode goes off.
Which paths can drop random mode
A media write that replaces imageUrl / mediaType while imageMode is "random" is treated as switching the bot back to fixed media.
Every in-chat media-write path — the post-fork wizard's Edit Media, the settings card's Buy Media, and /buybotimage whether attached to the command or sent as the next message, in a DM or a group — asks first and writes nothing until the owner confirms.
The dashboard's own media upload does not ask
Uploading new media from the dashboard while
imageModeis"random"writes over the fixed-media fields immediately, with no confirmation shown, and leavesimageModeexactly as it was — the newly uploaded file becomes the fixed-media fallback without the bot ever leaving random mode. The upload takes effect immediately; it doesn't wait for a separate Save & Push.
Dashboard upload limits
| Setting | Value |
|---|---|
| Accepted | jpg, jpeg, png, webp, gif, mp4, webm |
| jpg / jpeg / png / webp | 5 MB max |
| gif / mp4 / webm | 20 MB max |
| Silent mp4 | Stored as animation (Telegram loops it like a GIF); an mp4 with an audio track is stored as video. |
Forking a layout and paste-to-import
`/forkbuybot` in Telegram and pasting a buy post into the dashboard's body editor both run through the same import mapper (`lib/buybot-import.ts`) and…
Chains, links and limits
The buy bot's 9 supported chains, how each of the 11 link tokens resolves to a URL, and every buy-bot limit confirmed in source.