Mirror Telegram group posts into the Crypto Team Build Discord

Discord relaunch 2026-10-09: the shared discord-relay.cjs fans every post that goes to the
community group out to the matching Discord channel (achievements topic -> #achievements,
payments topic -> #payment-proofs) through DISCORD_WEBHOOK_* webhooks. Telegram HTML is
converted to Discord markdown, buttons become links, cards post as images. DMs and alert
chats are not mirrored. Fire-and-forget; off when the env is unset.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Marty Bostick
2026-10-09 13:57:38 +00:00
parent 1bace54bc2
commit fe61842525
2 changed files with 88 additions and 0 deletions
+2
View File
@@ -13,6 +13,7 @@
// Who may sign in is a setting (admin page): 'testers' (allowlist), 'open', 'closed'.
'use strict';
const http = require('http');
const discordRelay = require('./discord-relay.cjs'); // mirror group posts into the CTB Discord (2026-10-09)
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
@@ -55,6 +56,7 @@ async function telegramPhoto(file, caption, general, topicOverride) {
if (!outbound()) return false;
const tok = process.env.DR_TG_TOKEN, chat = process.env.DR_TG_PUBLIC_CHAT || process.env.DR_TG_CHAT, topic = process.env.DR_TG_PUBLIC_CHAT ? (topicOverride || process.env.DR_TG_PUBLIC_TOPIC) : null;
if (!tok || !chat || !file) return false;
discordRelay.mirror({ chatId: chat, threadId: topic && !general ? Number(topic) : undefined, text: caption, photo: fs.readFileSync(file) });
try {
const fd = new FormData(); fd.append('chat_id', chat); fd.append('caption', caption); fd.append('parse_mode', 'HTML'); if (topic && !general) fd.append('message_thread_id', String(topic));
fd.append('photo', new Blob([fs.readFileSync(file)], { type: 'image/jpeg' }), 'badge.jpg');