mirror of
https://github.com/BEARlogin/max-telegram-bridge-bot.git
synced 2026-04-28 03:39:46 +00:00
Issue #38 part 2. Allows using multiple MAX group chats as per-thread mirrors of a TG forum group, since MAX has no native thread concept. - New table thread_pairs (tg_chat_id, tg_thread_id, max_chat_id) with unique(max_chat_id) — one MAX chat = at most one TG thread. - pending gains thread_id column for thread-bridge key exchange. - Repo methods: StartThreadBridge (TG issues key), CompleteThreadBridge (MAX consumes key), GetThreadMaxChat, GetThreadTgPair, UnpairThread, UnpairThreadByMax. - Commands: * /thread_bridge in a TG forum thread (admin, non-General) -> key * /thread_bridge <key> in a MAX chat -> binds * /thread_unbridge on either side TG's BOT_COMMAND_INVALID rule forbids hyphens, so the commands use underscore. - Routing priority: thread-bridge > regular pair. TG->MAX: if msg.MessageThreadID has a thread_pair, route there. MAX->TG: if MAX chat is in thread_pairs, route to (tg_chat, thread). - For thread-paired MAX chats, the Part 1 reply-to-source-thread override is disabled: thread-paired chats have a fixed target thread, replies stay there. - Safeguard: a MAX chat cannot be in both pairs and thread_pairs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 lines
163 B
SQL
4 lines
163 B
SQL
DROP INDEX IF EXISTS idx_thread_pairs_max;
|
|
DROP INDEX IF EXISTS idx_thread_pairs_tg;
|
|
DROP TABLE IF EXISTS thread_pairs;
|
|
ALTER TABLE pending DROP COLUMN thread_id;
|