mautrix telegram bridge conduittitle
2024-09-24date
使用 mautrix 桥接 telegram 和 conduit
description- 有一个自己的 matrix server
大概就是给已有的 telegram room 创建 matrix room 镜像,然后以自己的matrix账号发信可以在telegram用对应的telegram账号发信。
应该是可以实现的吧?本文边实践边记录的。
参考了nickcao的配置
systemd.services = {
mautrix-telegram.serviceConfig.RuntimeMaxSec = 86400;
};
services.mautrix-telegram = {
enable = true;
environmentFile = config.age.secrets.mautrix-tg.path;
serviceDependencies = [ "conduit.service" ];
settings = {
homeserver = {
address = "http://127.0.0.1:${toString config.services.matrix-conduit.settings.global.port}";
domain = config.services.matrix-conduit.settings.global.server_name;
};
appservice = {
address = "http://127.0.0.1:6169";
database = "postgres:///mautrix-telegram?host=/run/postgresql";
hostname = "127.0.0.1";
port = 6169;
provisioning.enabled = false;
};
bridge = {
displayname_template = "{displayname}";
public_portals = true;
delivery_error_reports = true;
incoming_bridge_error_reports = true;
bridge_matrix_leave = false;
relay_user_distinguishers = [ ];
create_group_on_invite = false;
animated_sticker = {
target = "webp";
convert_from_webm = true;
};
state_event_formats = {
join = "";
leave = "";
name_change = "";
};
permissions = {
"*" = "relaybot";
"@sec:nyaw.xyz" = "admin";
};
relaybot = {
authless_portals = false;
};
};
telegram = {
# 抄 tdesktop 的
api_id = 611335;
api_hash = "d524b414d21f4d37f08684c1df41ac9c";
device_info = {
app_version = "3.5.2";
};
force_refresh_interval_seconds = 3600;
};
logging = {
loggers = {
mau.level = "WARNING";
telethon.level = "WARNING";
};
};
};
};
运行一次 mautrix server 之后 在 /var/lib/mautrix-telegram
会生成一个 telegram-registration.yaml
。把 as_token
hs_token
填回配置。
然后在自己的 matrix client 私聊 @telegrambot:domain.com
再发help, 查看后续攻略。
可以直接 login
登陆telegram账号。到达基本使用的步骤基本就这些,但是文档一大堆东西混在一起混乱不堪,令人费解。