How tud8951/trirelay works
TriRelay is a Cloudflare Worker bridge between Telegram and Discord, with a password-protected web inbox as a second user-facing workflow. Users can send web-form messages and images to either platform; Telegram messages and Discord slash commands can also feed the inbox or bridge content across platforms. The Worker handles webhook and API routes, platform transfers, session checks, and inbox operations, with Cloudflare D1 storing inbox records and Discord attachment metadata. The README documents the main routes and capabilities; sampled source excerpts show selected handler and UI behavior, but not every route implementation.
Main entry points: frontend.ts Web interface · index.ts Worker routes · migrations Inbox database
Components 18
Message Bridge
- Telegram webhook
src/index.ts - Discord interactions
src/index.ts - Discord to Telegram
src/index.ts - Telegram to Discord
src/index.ts
Web Inbox
- Web interface
src/frontend.ts - Web session auth
src/index.ts - Web message send
src/index.ts - Inbox commands
src/index.ts - Inbox history
src/index.ts - Image proxy
src/index.ts - Inbox database
migrations
Worker Runtime
- Worker routes
src/index.ts - Command registration
src/index.ts
Messaging Platforms
- Telegram Bot API
- Discord API
Other components
- Browser user
- Telegram user
- Discord user
Connections 27
- Browser user → Web interface: opens inbox
README.md - Web interface → Worker routes: calls Worker APIs
README.md - Worker routes → Web interface: serves interface
src/index.ts - Worker routes → Web session auth: checks sessions
src/index.ts - Web session auth → Web message send: authorizes send
src/index.ts - Web message send → Telegram Bot API: sends messages
README.md - Web message send → Discord API: sends messages
README.md - Telegram user → Telegram Bot API: sends /web
README.md - Telegram Bot API → Telegram webhook: posts webhook
README.md - Telegram webhook → Telegram to Discord: forwards content
README.md - Telegram to Discord → Discord API: sends content
README.md - Telegram webhook → Inbox commands: routes /web
README.md - Discord user → Discord API: runs commands
README.md - Discord API → Discord interactions: posts interaction
README.md - Discord interactions → Discord to Telegram: dispatches /bridge
src/index.ts - Discord to Telegram → Telegram Bot API: sends content
README.md - Discord interactions → Inbox commands: dispatches /web
src/index.ts - Inbox commands → Inbox database: writes messages
README.md - Web message send → Inbox database: stores inbox data
README.md - Web interface → Inbox history: loads history
README.md - Inbox history → Inbox database: reads messages
README.md - Web interface → Image proxy: requests previews
README.md - Image proxy → Inbox database: reads attachment metadata
README.md - Image proxy → Discord API: follows CDN links
README.md - Web interface → Worker routes: registers commands
README.md - Worker routes → Command registration: handles registration
src/index.ts - Command registration → Discord API: registers commands
src/index.ts