安装

$ yay -S mautrix-telegram

postgresql

前期操作参见 PostgreSQL

# sudo -u postgres createuser -P mautrix-telegram_user
# sudo -u postgres createdb -O mautrix-telegram_user mautrix-telegram_db

appservices

这里以 Dendrite 为例

编辑/etc/dendrite/config.yaml

app_service_api:
#  config_files: []
  config_files:
  - /etc/mautrix-telegram/registration.yaml

然后

# gpasswd -a dendrite mautrix-telegram

telegram API

my.telegram.org 获取 app ID 以及 hash

config

编辑 /etc/mautrix-telegram/config.yaml

homeserver:
    # The address that this appservice can use to connect to the homeserver.
    address: https://HOMSER_SERVER
    # The domain of the homeserver (for MXIDs, etc).
    domain: HOMSER_SERVER

database: 填写 postgres://mautrix-telegram:<password>@localhost/mautrix-telegram

permissions: 配置如下

    permissions:
        '*': relaybot
        SERVER_DOMAIN: full
        '@SERVER_USER:SERVER_DOMAIN': admin

telegram:app_id app_hash 分别填入 app ID hash

生成 registion.yaml

3 python -m mautrix_telegram -b /usr/share/mautrix-telegram/example-config.yaml -c /etc/mautrix-telegram/config.yaml -r /etc/mautrix-telegram/registration.yaml -g

注意权限

# cd /etc/mautrix-telegram
# chown -R mautrix-telegram:mautrix-telegram *

图像音频处理

LottieConverter 贴纸 ffmpeg 转码音频

启动

必须要启动 mautrix-telegram 后再重启 homeserver,如 Dendrite

# systemctl start mautrix-telegram && systemctl enable mautrix-telegram
# systemctl restart homeserver

使用 Telegarm bridge bot

和 @telegrambot:YOUR_SERVER 对话

login 登陆

help 帮助

sync contacts/me/chats 同步

pm @telegram_id/telephone_number 私聊