DCAS handbook

Telegram bridge

Available on builds with bridge-tg feature enabled.

Telegram bot setup

  1. Contact @BotFather tg bot;
  2. Create new bot;
  3. Change bot settings:
    • group privacy -> disable (otherwise bridge would not see messages);
    • group admin rights -> grant at least the following permissions:
      • delete messages (otherwise bridge would not be able to delete messages);

Linking

  1. Add bot to your Telegram channel;
  2. In telegram channel you want to link:
    1. Enter /channel_id;
    2. Bot would respond with Channel id is TG:-12345/65 message;
    3. Copy channel id bot gave you (TG:-12345/67) to clipboard;
  3. In DC channel you want to link: use app command /bridge link outer TG:-12345/67 replacing TG:-12345/67 with the channel id you copied earlier;
  4. You should see This channel is now linked to TG's -12345/67 in both DC and TG channels;

Unlinking

Use /bridge unlink ext:TG in DC channel to unlink.

Proxy

Bridge-tg has tg_proxy configuration parameter that makes Telegram bot route its TG traffic via the http:// or socks5:// proxy you’ve specified. This might be useful when you host your TG bot in a shitty censorship state for some reason.

Also it would be wise to have multiple tg_proxy parameters pointing to a different kinds of proxies (e.g. first points to a local tor service, second points to a local sing-box inbound, third points to a remote http proxy). As bridge-tg does not support runtime proxy selection, you might have no more than one active tg_proxy at a time, others must be commented-out. When your current proxy would be nuked by govt, you’d just have to uncomment new one and restart bridge-tg, keeping bot’s downtime at low.

Operation notes

Message reactions are synced only in TG->DC direction: there are no way to represent DC’s entire Vec<(ReactionType, Vec<ReactedUser>)> with only one reaction TG bridge is allowed to post. If you have a solution please reach project devs!

There’s a chance that bot cease forwarding messages in TG->DC direction (it happened to us only once in a half a year). The exact reason of it is not known, and presumed to be a limitation / bug on Telegram side. To work around the issue one might replace misbehaving TG bot with a newly created one.

Other notes

You can use this space symbol >< as a bot name to hide it;

It is hard to read conversation between multiple DC guys from TG. You may want to ask DC people to change their names to emoji+name (for example, Somobu would be a 🦊 Somobu) to make usernames more distinguishable on TG side;