How lordgrim77/postfixer works
Purpose and deployment shape
PostFixer is a Telegram rich-message system deployed as three independent Cloudflare Workers: a bot backend, a formatting Web App, and a custom-emoji manager. The workers are manually deployed as self-contained JavaScript; frontends are embedded into worker artifacts rather than hosted separately.
Core deployable entry points:
• worker.js
• webapp_worker.js
• emoji_manager_worker.src.js (source; compiled target is expected as emoji_manager_worker.js, though that non-obfuscated root artifact is absent)
• obfuscated/emoji_manager_worker.js
Telegram bot backend
worker.js is the webhook-facing control plane. It receives Telegram updates, handles normal bot interactions and inline queries, applies rich formatting, and calls Gemini for AI-assisted formatting behavior. It also connects the bot experience to the formatting and emoji-management web apps through configured public URLs.
Relevant boundaries:
• Telegram Bot API through BOT_TOKEN
• Google Gemini through GEMINI_API_KEY
• Cloudflare bindings: KV, EMOJI_MANAGER_KV, and D1 DB
• Runtime configuration including BOT_USERNAME, ADMINS, and EMOJI_MANAGER_URL
Formatting Web App worker
The formatting Web App is an API-and-static-hosting worker. Its editable template is webapp_worker.src.js; webapp_worker.js is the generated deployable artifact. It serves the rich-text editor UI and coordinates API calls that require the bot token or the bot worker.
Paths:
• webapp_worker.src.js
• webapp_worker.js
• frontend/index.html
• frontend/app.js
• frontend/react_editor.js
The worker’s infrastructure boundary is Cloudflare WEBAPP_KV, with BOT_WORKER_URL used to reach the bot backend and BOT_TOKEN used for Telegram operations.
Emoji manager worker
The emoji manager is a separate Web App/API boundary for associating standard Unicode emojis with Telegram Premium custom emoji stickers. It retrieves sticker metadata from Telegram and supports personal mappings plus administrator-managed global fallback mappings. The UI uses hover-triggered Lottie animation behavior to limit client CPU use.
Paths:
• emoji_manager_worker.src.js
• emoji_manager_frontend/index.html
• emoji_manager_frontend/app.js
• emoji_manager_frontend/style.css
It uses EMOJI_MANAGER_KV for persisted mappings, ADMINS to authorize global edits, and BOT_TOKEN to query Telegram.
Frontend-to-worker asset pipeline
The source frontends are not independently deployed. build_all_obfuscated.js reads the formatting and emoji-manager frontend assets, encodes them into worker-served content, obfuscates JavaScript, and emits deployment artifacts. Any UI modification requires rebuilding before worker deployment.
Paths:
• build_all_obfuscated.js
• frontend/
• emoji_manager_frontend/
• obfuscated/webapp_worker.js
• obfuscated/emoji_manager_worker.js
build_combined.js and related patch scripts indicate an evolving generated-worker workflow, but the all-in-one build script is the documented primary pipeline.
Storage and cross-service flow
Primary request flow is: Telegram update → worker.js → Telegram/Gemini/KV/D1 as needed → Telegram response. For interactive editing, Telegram opens the formatting worker, which serves its embedded UI and communicates with the bot worker/Telgram APIs. Emoji-manager interactions remain isolated in their own worker and KV namespace binding, while the bot references its public URL to expose the feature.
D1 holds aggregate counters in global_stats; KV stores application state, web-app state, and emoji mappings. Cloudflare Workers provide the runtime, Telegram is the user-facing external platform, and Gemini is the AI dependency.
Main entry points: webapp_worker.js Formatting Web App · build_all_obfuscated.js Artifact builder · worker.js Update & formatting handler · emoji_manager_worker.js Emoji manager Web App
Components 19
Cloudflare Workers
Three independently deployed worker applications.
- Bot backend · Receives updates, applies formatting, and handles inline queries.
worker.js - Update & formatting handler · Coordinates bot interactions, rich messages, and AI-assisted behavior.
worker.js - Formatting worker source
webapp_worker.src.js - Formatting Web App · Serves the embedded editor and coordinates bot-backed operations.
webapp_worker.js - Emoji worker source
emoji_manager_worker.src.js - Emoji manager Web App · Manages personal and admin global custom-emoji mappings.
obfuscated/emoji_manager_worker.js
Embedded frontends
Source UI assets are bundled into worker artifacts.
- Rich-text editor UI
- Editor shell
frontend/index.html - Editor client
frontend/app.js - React editor
frontend/react_editor.js - Emoji manager UI · Includes hover-triggered Lottie animation behavior.
- Emoji UI shell
emoji_manager_frontend/index.html - Emoji UI client
emoji_manager_frontend/app.js - Emoji UI styles
emoji_manager_frontend/style.css - Artifact builder · Embeds assets, obfuscates JavaScript, and emits deployable workers.
build_all_obfuscated.js
External services & storage
- Telegram · User-facing Bot API and Web App platform.
- Google Gemini
- Cloudflare KV · KV, WEBAPP_KV, and EMOJI_MANAGER_KV hold application and mapping state.
- Cloudflare D1 · Stores aggregate counters in global_stats.
Connections 27
- Telegram → Bot backend: webhook updates
- Bot backend → Update & formatting handler: dispatches
- Update & formatting handler → Telegram: Bot API responses
- Update & formatting handler → Google Gemini: AI formatting
- Update & formatting handler → Cloudflare KV: state and emoji mappings
- Update & formatting handler → Cloudflare D1: global_stats
- Bot backend → Formatting Web App: opens Web App URL
- Bot backend → Emoji manager Web App: exposes manager URL
- Telegram → Formatting Web App: opens editor
- Formatting Web App → Bot backend: BOT_WORKER_URL
- Formatting Web App → Telegram: bot-token operations
- Formatting Web App → Cloudflare KV: WEBAPP_KV
- Telegram → Emoji manager Web App: opens manager
- Emoji manager Web App → Telegram: sticker metadata
- Emoji manager Web App → Cloudflare KV: EMOJI_MANAGER_KV
- Editor shell → Rich-text editor UI: part of
- Editor client → Rich-text editor UI: part of
- React editor → Rich-text editor UI: part of
- Emoji UI shell → Emoji manager UI: part of
- Emoji UI client → Emoji manager UI: part of
- Emoji UI styles → Emoji manager UI: part of
- Rich-text editor UI → Artifact builder: bundled
- Emoji manager UI → Artifact builder: bundled
- Formatting worker source → Artifact builder: build input
- Emoji worker source → Artifact builder: build input
- Artifact builder → Formatting Web App: generated artifact
- Artifact builder → Emoji manager Web App: obfuscated artifact