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:29 +00:00
parent f53bd67d30
commit efb6020e40
2 changed files with 89 additions and 0 deletions
+3
View File
@@ -5,6 +5,7 @@
// Chain selection (Amoy rehearsal vs mainnet) lives in data/config.json —
// see chain.js. Wipe the volume's accounts/sessions + flip config = launch.
const http = require('http');
const discordRelay = require('./discord-relay.cjs'); // mirror group posts into the CTB Discord (2026-10-09)
const https = require('https');
const dns = require('dns');
const fs = require('fs');
@@ -1214,6 +1215,7 @@ async function tankNotifyTick() {
async function telegramSend(chatId, text, threadId) {
const sc = siteConfig();
if (!sc.telegramBotToken || !chatId) return;
discordRelay.mirror({ chatId, threadId, text });
const body = JSON.stringify(Object.assign({ chat_id: chatId, text, parse_mode: 'HTML', disable_web_page_preview: true }, threadId ? { message_thread_id: Number(threadId) } : {}));
await new Promise((resolve) => {
const rq = https.request({ hostname: 'api.telegram.org', path: '/bot' + sc.telegramBotToken + '/sendMessage', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) }, timeout: 10000 }, r => {
@@ -1233,6 +1235,7 @@ async function telegramSend(chatId, text, threadId) {
async function telegramSendPhoto(chatId, jpeg, caption, threadId) {
const sc = siteConfig();
if (!sc.telegramBotToken || !chatId || !jpeg) return false;
discordRelay.mirror({ chatId, threadId, text: caption, photo: jpeg });
const B = '----iapbadge' + crypto.randomBytes(8).toString('hex');
const field = (n, v) => Buffer.from('--' + B + '\r\nContent-Disposition: form-data; name="' + n + '"\r\n\r\n' + v + '\r\n');
const parts = [field('chat_id', String(chatId)), field('caption', caption), field('parse_mode', 'HTML')];