diff --git a/pillar/role/matrix.sls b/pillar/role/matrix.sls
index 5416d3f..478500c 100644
--- a/pillar/role/matrix.sls
+++ b/pillar/role/matrix.sls
@@ -22,6 +22,9 @@ profile:
repo: https://github.com/matrix-org/matrix-appservice-irc
port: 9003
appservice_id: 1deb544b666b3aba1d9d49d3d4785eeb2fb2befa24e0743c91e6290866003c33
+ telegram:
+ appservice_id: oepzkscngbyqvopzn773ns7whfxyfslgjhy7mumy7syurqp3f4kvb4sgufz9nfsw
+ api_id:
sudoers:
included_files:
diff --git a/pillar/secrets/role/matrix.sls b/pillar/secrets/role/matrix.sls
index 5da5d1b..8d1cbd8 100644
--- a/pillar/secrets/role/matrix.sls
+++ b/pillar/secrets/role/matrix.sls
@@ -1292,6 +1292,192 @@ profile:
DleghUs/mZA7pJPn5LI5lKz+JH/lJEmOx2kaK+2c0+1Hr4KTtQ==
=WgeA
-----END PGP MESSAGE-----
+ telegram:
+ appservice_token: |
+ -----BEGIN PGP MESSAGE-----
+
+ hQQOA7A9CHm0S6RyEA/+Pilul5GBwRIfHgpeQM1eUf6e0Y36/UttZDdS0v7PomKY
+ Pe3MzT/GIoZAuRPdB+4P1NcYTiv/HCj5yrnmt3lJsygitATnkuLomZU6ly07ykXT
+ xC6SPcGFmhoNAf0zf5w/5zdY9gKWklH7udBvoK+fjd2l36g6/sKZfe14iFF9ms1k
+ 8miqmm9Qw51u0URyEFzfnLfauFj59jC1wLcwb+Y61KRq4PcaAut8k7fgGI2oWbb8
+ wnSJhvIkGtETz4LMuGm05FgaAV8czcZRaI75OY+PZeJGmoXkZioVg+4Cmtj2sdC/
+ YGQC4rtGIPdt7p7Af1LDlB+H86Ku9CvTr05qLMoFW0uZR5fFpaD9BiP7LITUJ39J
+ 0vz4/T7+QpdgloDuKFo7i4KlhAmana1KxND71SfzaDFWhfGCpOXAe1QFtw10xnEn
+ DtKJ71JhuPJxteVO+uqSKOLGspP2E87DcVeJtOBhWeW29v6cN2a5dubKn99IhNQq
+ KhYdqxhR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SNNzP3Zuy97kSgj5UZ/TTbre+LEhbzB/M83drY
+ JUmr99aZj5D+cZwgkU3y5JBHShOvCN8X8J8zFUXAqGUnk0EeyRB6mXy7oVd8Hck7
+ pHTHoY5Y6TyzLcFmAn+wpnb9Hxl3FRiPO9OEoNxphcF5DNzVEHxuzaXZy2I=
+ =100I
+ -----END PGP MESSAGE-----
+ api_hash: |
+
+ bot_token: |
+
+
postgres:
users:
diff --git a/salt/profile/matrix/appservice.sls b/salt/profile/matrix/appservice.sls
index 596ba38..9d2bca6 100644
--- a/salt/profile/matrix/appservice.sls
+++ b/salt/profile/matrix/appservice.sls
@@ -1,6 +1,6 @@
-{% set roles = salt['grains.get']('roles', []) %}
+{% set appservices = salt['pillar.get']('profile:matrix:appservices') %}
-discord_pgks:
+appservice_pgks:
pkg.installed:
- pkgs:
- git
@@ -11,60 +11,92 @@ discord_pgks:
- gcc
- gcc-c++
-/var/lib/matrix-synapse/discord:
+{% for dir, data in appservices.items() %}
+/var/lib/matrix-synapse/{{ dir }}:
file.directory:
- user: synapse
-https://github.com/Half-Shot/matrix-appservice-discord.git:
+{{ data.repo }}:
git.latest:
- - branch: master
- - target: /var/lib/matrix-synapse/discord/
- - rev: master
+ - branch: {{ data.get('branch', 'master') }}
+ - target: /var/lib/matrix-synapse/{{ dir }}
+ - rev: {{ data.get('branch', 'master') }}
- user: synapse
-discord_conf_file:
+
+{{ dir }}_conf_file:
file.managed:
- - name: /var/lib/matrix-synapse/discord/config.yaml
- - source: salt://profile/matrix/files/config-discord.yaml
+ - name: /var/lib/matrix-synapse/{{ dir }}/config.yaml
+ - source: salt://profile/matrix/files/config-{{ dir }}.yaml
- template: jinja
- user: synapse
- require:
- - file: /var/lib/matrix-synapse/discord
+ - file: /var/lib/matrix-synapse/{{ dir }}
- require_in:
- - service: discord_service
+ - service: {{ dir }}_service
- watch_in:
- - module: discord_restart
+ - module: {{ dir }}_restart
-discord_appservice_file:
+{{ dir }}_appservice_file:
file.managed:
- - name: /var/lib/matrix-synapse/discord/discord-registration.yaml
- - source: salt://profile/matrix/files/appservice-discord.yaml
+ - name: /var/lib/matrix-synapse/{{ dir }}/{{ dir }}-registration.yaml
+ - source: salt://profile/matrix/files/appservice-{{ dir }}.yaml
- user: synapse
- template: jinja
- require:
- - file: /var/lib/matrix-synapse/discord
+ - file: /var/lib/matrix-synapse/{{ dir }}
+ - watch_in:
+ - module: {{ dir }}_restart
+
+synapse_appservice_{{ dir }}_file:
+ file.managed:
+ - name: /etc/matrix-synapse/appservices/appservice-{{ dir }}.yaml
+ - source: salt://profile/matrix/files/appservice-{{ dir }}.yaml
+ - template: jinja
+ - require:
+ - file: /var/lib/matrix-synapse/{{ dir }}
- watch_in:
- - module: discord_restart
+ - module: {{ dir }}_restart
-discord_boostrap:
+{{ dir }}_boostrap:
cmd.run:
- name: npm install
- - cwd: /var/lib/matrix-synapse/discord
+ - cwd: /var/lib/matrix-synapse/{{ dir }}
- runas: synapse
- env:
- NODE_VERSION: 10
-discord_build:
+{{ dir }}_build:
cmd.run:
- name: npm run build
- - cwd: /var/lib/matrix-synapse/discord
+ - cwd: /var/lib/matrix-synapse/{{ dir }}
- runas: synapse
- env:
- NODE_VERSION: 10
-discord_systemd_file:
+{{ dir }}_systemd_file:
file.managed:
- - name: /etc/systemd/system/discord.service
- - source: salt://profile/matrix/files/discord.service
+ - name: /etc/systemd/system/{{ dir }}.service
+ - template: jinja
+ - context:
+ dir: {{ dir }}
+ port: {{ data.get('port') }}
+ - source: salt://profile/matrix/files/appservice.service
- require_in:
- - service: discord_service
+ - service: {{ dir }}_service
+
+{{ dir }}_service:
+ service.running:
+ - name: {{ dir }}
+ - enable: True
+ - require:
+ - service: synapse_service
+
+{{ dir }}_restart:
+ module.wait:
+ - name: service.restart
+ - m_name: {{ dir }}
+ - require:
+ - service: synapse_service
+ - service: {{ dir }}_service
+{% endfor %}
diff --git a/salt/profile/matrix/files/appservice-telegram.yaml b/salt/profile/matrix/files/appservice-telegram.yaml
new file mode 100644
index 0000000..bf0aa69
--- /dev/null
+++ b/salt/profile/matrix/files/appservice-telegram.yaml
@@ -0,0 +1,14 @@
+id: {{ pillar['profile']['matrix']['telegram']['appservice_id'] }}
+as_token: {{ pillar['profile']['matrix']['telegram']['appservice_token'] }}
+hs_token: {{ pillar['profile']['matrix']['telegram']['homeserver_token'] }}
+namespaces:
+ users:
+ - exclusive: true
+ regex: '@telegram_.+:opensuse.org'
+ group_id: +telegram:opensuse.org
+ aliases:
+ - exclusive: true
+ regex: '#telegram_.+:opensuse.org'
+url: http://localhost:29317
+sender_localpart: telegrambot
+rate_limited: false
diff --git a/salt/profile/matrix/files/config-telegram.yaml b/salt/profile/matrix/files/config-telegram.yaml
new file mode 100644
index 0000000..354b1f5
--- /dev/null
+++ b/salt/profile/matrix/files/config-telegram.yaml
@@ -0,0 +1,418 @@
+# Homeserver details
+homeserver:
+ # The address that this appservice can use to connect to the homeserver.
+ address: https://matrix.opensuse.org
+ # The domain of the homeserver (for MXIDs, etc).
+ domain: opensuse.org
+ # Whether or not to verify the SSL certificate of the homeserver.
+ # Only applies if address starts with https://
+ verify_ssl: true
+
+# Application service host/registration related details
+# Changing these values requires regeneration of the registration.
+appservice:
+ # The address that the homeserver can use to connect to this appservice.
+ address: http://localhost:29317
+
+ # The hostname and port where this appservice should listen.
+ hostname: 0.0.0.0
+ port: 29317
+ # The maximum body size of appservice API requests (from the homeserver) in mebibytes
+ # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
+ max_body_size: 1
+
+ # The full URI to the database. SQLite and Postgres are fully supported.
+ # Other DBMSes supported by SQLAlchemy may or may not work.
+ # Format examples:
+ # SQLite: sqlite:///filename.db
+ # Postgres: postgres://username:password@hostname/dbname
+ database: postgresql://{{ pillar['profile']['matrix']['database_user'] }}:{{ pillar['postgres']['users']['matrix']['password'] }}@{{ pillar['profile']['matrix']['database_host'] }}/telegram_bridge
+
+ # Public part of web server for out-of-Matrix interaction with the bridge.
+ # Used for things like login if the user wants to make sure the 2FA password isn't stored in
+ # the HS database.
+ public:
+ # Whether or not the public-facing endpoints should be enabled.
+ enabled: false
+ # The prefix to use in the public-facing endpoints.
+ prefix: /public
+ # The base URL where the public-facing endpoints are available. The prefix is not added
+ # implicitly.
+ external: https://example.com/public
+
+ # Provisioning API part of the web server for automated portal creation and fetching information.
+ # Used by things like Dimension (https://dimension.t2bot.io/).
+ provisioning:
+ # Whether or not the provisioning API should be enabled.
+ enabled: true
+ # The prefix to use in the provisioning API endpoints.
+ prefix: /_matrix/provision/v1
+ # The shared secret to authorize users of the API.
+ # Set to "generate" to generate and save a new token.
+ shared_secret: generate
+
+ # The unique ID of this appservice.
+ id: {{ pillar['profile']['matrix']['telegram']['appservice_id'] }}
+ # Username of the appservice bot.
+ bot_username: telegrambot
+ # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
+ # to leave display name/avatar as-is.
+ bot_displayname: Telegram
+ bot_avatar: mxc://maunium.net/tJCRmUyJDsgRNgqhOgoiHWbX
+
+ # Community ID for bridged users (changes registration file) and rooms.
+ # Must be created manually.
+ #
+ # Example: "+telegram:example.com". Set to false to disable.
+ community_id: "+telegram:opensuse.org"
+
+ # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
+ as_token: "{{ pillar['profile']['matrix']['telegram']['appservice_token'] }}"
+ hs_token: "{{ pillar['profile']['matrix']['telegram']['homeserver_token'] }}"
+
+# Prometheus telemetry config. Requires prometheus-client to be installed.
+# metrics:
+ # enabled: false
+ # listen_port: 8000
+
+# Manhole config.
+# manhole:
+ # Whether or not opening the manhole is allowed.
+ # enabled: false
+ # The path for the unix socket.
+ # path: /var/tmp/mautrix-telegram.manhole
+ # The list of UIDs who can be added to the whitelist.
+ # If empty, any UIDs can be specified in the open-manhole command.
+ # whitelist:
+ # - 0
+
+# Bridge config
+bridge:
+ # Localpart template of MXIDs for Telegram users.
+ # {userid} is replaced with the user ID of the Telegram user.
+ username_template: "telegram_{userid}"
+ # Localpart template of room aliases for Telegram portal rooms.
+ # {groupname} is replaced with the name part of the public channel/group invite link ( https://t.me/{} )
+ alias_template: "telegram_{groupname}"
+ # Displayname template for Telegram users.
+ # {displayname} is replaced with the display name of the Telegram user.
+ displayname_template: "{displayname} [Telegram]"
+
+ # Set the preferred order of user identifiers which to use in the Matrix puppet display name.
+ # In the (hopefully unlikely) scenario that none of the given keys are found, the numeric user
+ # ID is used.
+ #
+ # If the bridge is working properly, a phone number or an username should always be known, but
+ # the other one can very well be empty.
+ #
+ # Valid keys:
+ # "full name" (First and/or last name)
+ # "full name reversed" (Last and/or first name)
+ # "first name"
+ # "last name"
+ # "username"
+ # "phone number"
+ displayname_preference:
+ - full name
+ - username
+ - phone number
+ # Maximum length of displayname
+ displayname_max_length: 100
+
+ # Maximum number of members to sync per portal when starting up. Other members will be
+ # synced when they send messages. The maximum is 10000, after which the Telegram server
+ # will not send any more members.
+ # Defaults to no local limit (-> limited to 10000 by server)
+ max_initial_member_sync: -1
+ # Whether or not to sync the member list in channels.
+ # If no channel admins have logged into the bridge, the bridge won't be able to sync the member
+ # list regardless of this setting.
+ sync_channel_members: true
+ # Whether or not to skip deleted members when syncing members.
+ skip_deleted_members: true
+ # Whether or not to automatically synchronize contacts and chats of Matrix users logged into
+ # their Telegram account at startup.
+ startup_sync: true
+ # Number of most recently active dialogs to check when syncing chats.
+ # Set to 0 to remove limit.
+ sync_dialog_limit: 30
+ # Whether or not to sync and create portals for direct chats at startup.
+ sync_direct_chats: false
+ # The maximum number of simultaneous Telegram deletions to handle.
+ # A large number of simultaneous redactions could put strain on your homeserver.
+ max_telegram_delete: 10
+ # Whether or not to automatically sync the Matrix room state (mostly unpuppeted displaynames)
+ # at startup and when creating a bridge.
+ sync_matrix_state: true
+ # Allow logging in within Matrix. If false, the only way to log in is using the out-of-Matrix
+ # login website (see appservice.public config section)
+ allow_matrix_login: true
+ # Whether or not to bridge plaintext highlights.
+ # Only enable this if your displayname_template has some static part that the bridge can use to
+ # reliably identify what is a plaintext highlight.
+ plaintext_highlights: false
+ # Whether or not to make portals of publicly joinable channels/supergroups publicly joinable on Matrix.
+ public_portals: false
+ # Whether or not to use /sync to get presence, read receipts and typing notifications when using
+ # your own Matrix account as the Matrix puppet for your Telegram account.
+ sync_with_custom_puppets: true
+ # Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
+ #
+ # If set, custom puppets will be enabled automatically for local users
+ # instead of users having to find an access token and run `login-matrix`
+ # manually.
+ login_shared_secret: null
+ # Set to false to disable link previews in messages sent to Telegram.
+ telegram_link_preview: true
+ # Use inline images instead of a separate message for the caption.
+ # N.B. Inline images are not supported on all clients (e.g. Riot iOS).
+ inline_images: false
+ # Maximum size of image in megabytes before sending to Telegram as a document.
+ image_as_file_size: 10
+ # Maximum size of Telegram documents in megabytes to bridge.
+ max_document_size: 100
+ # Enable experimental parallel file transfer, which makes uploads/downloads much faster by
+ # streaming from/to Matrix and using many connections for Telegram.
+ # Note that generating HQ thumbnails for videos is not possible with streamed transfers.
+ parallel_file_transfer: false
+ # Whether or not created rooms should have federation enabled.
+ # If false, created portal rooms will never be federated.
+ federate_rooms: true
+ # Settings for converting animated stickers.
+ animated_sticker:
+ # Format to which animated stickers should be converted.
+ # disable - No conversion, send as-is (gzipped lottie)
+ # png - converts to non-animated png (fastest),
+ # gif - converts to animated gif, but loses transparency
+ # webm - converts to webm video, requires ffmpeg executable with vp9 codec and webm container support
+ target: webm
+ # Arguments for converter. All converters take width and height.
+ # GIF converter takes background as a hex color.
+ args:
+ width: 256
+ height: 256
+ fps: 30
+
+ # Overrides for base power levels.
+ initial_power_level_overrides:
+ user: {}
+ group: {}
+
+ # Whether to bridge Telegram bot messages as m.notices or m.texts.
+ bot_messages_as_notices: true
+ bridge_notices:
+ # Whether or not Matrix bot messages (type m.notice) should be bridged.
+ default: false
+ # List of user IDs for whom the previous flag is flipped.
+ # e.g. if bridge_notices.default is false, notices from other users will not be bridged, but
+ # notices from users listed here will be bridged.
+ # exceptions:
+ # - "@importantbot:example.com"
+
+ # Some config options related to Telegram message deduplication.
+ # The default values are usually fine, but some debug messages/warnings might recommend you
+ # change these.
+ deduplication:
+ # Whether or not to check the database if the message about to be sent is a duplicate.
+ pre_db_check: false
+ # The number of latest events to keep when checking for duplicates.
+ # You might need to increase this on high-traffic bridge instances.
+ cache_queue_length: 20
+
+ # The formats to use when sending messages to Telegram via the relay bot.
+ # Text msgtypes (m.text, m.notice and m.emote) support HTML, media msgtypes don't.
+ #
+ # Available variables:
+ # $sender_displayname - The display name of the sender (e.g. Example User)
+ # $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
+ # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
+ # $message - The message content
+ message_formats:
+ m.text: "$sender_displayname: $message"
+ m.notice: "$sender_displayname: $message"
+ m.emote: "* $sender_displayname $message"
+ m.file: "$sender_displayname sent a file: $message"
+ m.image: "$sender_displayname sent an image: $message"
+ m.audio: "$sender_displayname sent an audio file: $message"
+ m.video: "$sender_displayname sent a video: $message"
+ m.location: "$sender_displayname sent a location: $message"
+ # Telegram doesn't have built-in emotes, this field specifies how m.emote's from authenticated
+ # users are sent to telegram. All fields in message_formats are supported. Additionally, the
+ # Telegram user info is available in the following variables:
+ # $displayname - Telegram displayname
+ # $username - Telegram username (may not exist)
+ # $mention - Telegram @username or displayname mention (depending on which exists)
+ emote_format: "* $mention $formatted_body"
+
+ # The formats to use when sending state events to Telegram via the relay bot.
+ #
+ # Variables from `message_formats` that have the `sender_` prefix are available without the prefix.
+ # In name_change events, `$prev_displayname` is the previous displayname.
+ #
+ # Set format to an empty string to disable the messages for that event.
+ state_event_formats:
+ join: ""
+ leave: ""
+ name_change: ""
+
+ # Filter rooms that can/can't be bridged. Can also be managed using the `filter` and
+ # `filter-mode` management commands.
+ #
+ # Filters do not affect direct chats.
+ # An empty blacklist will essentially disable the filter.
+ filter:
+ # Filter mode to use. Either "blacklist" or "whitelist".
+ # If the mode is "blacklist", the listed chats will never be bridged.
+ # If the mode is "whitelist", only the listed chats can be bridged.
+ mode: blacklist
+ # The list of group/channel IDs to filter.
+ list: []
+
+ # The prefix for commands. Only required in non-management rooms.
+ command_prefix: "!tg"
+
+ # Permissions for using the bridge.
+ # Permitted values:
+ # relaybot - Only use the bridge via the relaybot, no access to commands.
+ # user - Relaybot level + access to commands to create bridges.
+ # puppeting - User level + logging in with a Telegram account.
+ # full - Full access to use the bridge, i.e. previous levels + Matrix login.
+ # admin - Full access to use the bridge and some extra administration commands.
+ # Permitted keys:
+ # * - All Matrix users
+ # domain - All users on that homeserver
+ # mxid - Specific user
+ permissions:
+ "*": "relaybot"
+ "public.example.com": "user"
+ "example.com": "full"
+ "@admin:example.com": "admin"
+
+ # Options related to the message relay Telegram bot.
+ relaybot:
+ private_chat:
+ # List of users to invite to the portal when someone starts a private chat with the bot.
+ # If empty, private chats with the bot won't create a portal.
+ invite: []
+ # Whether or not to bridge state change messages in relaybot private chats.
+ state_changes: true
+ # When private_chat_invite is empty, this message is sent to users /starting the
+ # relaybot. Telegram's "markdown" is supported.
+ message: This is a Matrix bridge relaybot and does not support direct chats
+ # List of users to invite to all group chat portals created by the bridge.
+ group_chat_invite: []
+ # Whether or not the relaybot should not bridge events in unbridged group chats.
+ # If false, portals will be created when the relaybot receives messages, just like normal
+ # users. This behavior is usually not desirable, as it interferes with manually bridging
+ # the chat to another room.
+ ignore_unbridged_group_chat: true
+ # Whether or not to allow creating portals from Telegram.
+ authless_portals: true
+ # Whether or not to allow Telegram group admins to use the bot commands.
+ whitelist_group_admins: true
+ # Whether or not to ignore incoming events sent by the relay bot.
+ ignore_own_incoming_events: true
+ # List of usernames/user IDs who are also allowed to use the bot commands.
+ # whitelist:
+ # - myusername
+ # - 12345678
+
+# Telegram config
+telegram:
+ # Get your own API keys at https://my.telegram.org/apps
+ api_id: {{ pillar['profile']['matrix']['telegram']['api_id'] }}
+ api_hash: {{ pillar['profile']['matrix']['telegram']['api_hash'] }}
+ # (Optional) Create your own bot at https://t.me/BotFather
+ bot_token: {{ pillar['profile']['matrix']['telegram']['bot_token'] }}
+
+ # Telethon connection options.
+ connection:
+ # The timeout in seconds to be used when connecting.
+ timeout: 120
+ # How many times the reconnection should retry, either on the initial connection or when
+ # Telegram disconnects us. May be set to a negative or null value for infinite retries, but
+ # this is not recommended, since the program can get stuck in an infinite loop.
+ retries: 5
+ # The delay in seconds to sleep between automatic reconnections.
+ retry_delay: 1
+ # The threshold below which the library should automatically sleep on flood wait errors
+ # (inclusive). For instance, if a FloodWaitError for 17s occurs and flood_sleep_threshold
+ # is 20s, the library will sleep automatically. If the error was for 21s, it would raise
+ # the error instead. Values larger than a day (86400) will be changed to a day.
+ flood_sleep_threshold: 60
+ # How many times a request should be retried. Request are retried when Telegram is having
+ # internal issues, when there is a FloodWaitError less than flood_sleep_threshold, or when
+ # there's a migrate error. May take a negative or null value for infinite retries, but this
+ # is not recommended, since some requests can always trigger a call fail (such as searching
+ # for messages).
+ request_retries: 5
+
+ # Device info sent to Telegram.
+ device_info:
+ # "auto" = OS name+version.
+ device_model: auto
+ # "auto" = Telethon version.
+ system_version: auto
+ # "auto" = mautrix-telegram version.
+ app_version: auto
+ lang_code: en
+ system_lang_code: en
+
+ # Custom server to connect to.
+ server:
+ # Set to true to use these server settings. If false, will automatically
+ # use production server assigned by Telegram. Set to false in production.
+ enabled: false
+ # The DC ID to connect to.
+ dc: 2
+ # The IP to connect to.
+ ip: 149.154.167.40
+ # The port to connect to. 443 may not work, 80 is better and both are equally secure.
+ port: 80
+
+ # Telethon proxy configuration.
+ # You must install PySocks from pip for proxies to work.
+ proxy:
+ # Allowed types: disabled, socks4, socks5, http, mtproxy
+ type: disabled
+ # Proxy IP address and port.
+ address: 127.0.0.1
+ port: 1080
+ # Whether or not to perform DNS resolving remotely. Only for socks/http proxies.
+ rdns: true
+ # Proxy authentication (optional). Put MTProxy secret in password field.
+ username: ""
+ password: ""
+
+# Python logging configuration.
+#
+# See section 16.7.2 of the Python documentation for more info:
+# https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
+logging:
+ version: 1
+ formatters:
+ colored:
+ (): mautrix_telegram.util.ColorFormatter
+ format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
+ normal:
+ format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
+ handlers:
+ file:
+ class: logging.handlers.RotatingFileHandler
+ formatter: normal
+ filename: ./mautrix-telegram.log
+ maxBytes: 10485760
+ backupCount: 10
+ console:
+ class: logging.StreamHandler
+ formatter: colored
+ loggers:
+ mau:
+ level: DEBUG
+ telethon:
+ level: INFO
+ aiohttp:
+ level: INFO
+ root:
+ level: DEBUG
+ handlers: [file, console]
diff --git a/salt/profile/matrix/files/homeserver.yaml b/salt/profile/matrix/files/homeserver.yaml
index 2667401..34449e9 100644
--- a/salt/profile/matrix/files/homeserver.yaml
+++ b/salt/profile/matrix/files/homeserver.yaml
@@ -1105,10 +1105,15 @@ report_stats: true
# - "m.room.name"
+{% set appservices = salt['pillar.get']('profile:matrix:appservices') %}
+
# A list of application service config files to use
#
app_service_config_files:
- - /etc/matrix-synapse/appservices/appservice-discord.yaml
+ {% for dir, data in appservices.items() %}
+ - /etc/matrix-synapse/appservices/appservice-{{ dir }}.yaml
+ {% endfor %}
+ - /etc/matrix-synapse/appservices/appservice-telegram.yaml
# Uncomment to enable tracking of application service IP addresses. Implicitly
# enables MAU tracking for application service users.
diff --git a/salt/profile/matrix/files/telegram.service b/salt/profile/matrix/files/telegram.service
new file mode 100644
index 0000000..b58eb62
--- /dev/null
+++ b/salt/profile/matrix/files/telegram.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Matrix Appservice Telegram
+
+[Service]
+Type=simple
+Restart=on-failure
+RestartSec=3
+
+User=synapse
+Group=synapse
+WorkingDirectory=/var/lib/matrix-synapse/telegram/
+ExecStart=python3 -m mautrix_telegram -c config.yaml -f telegram-registration.yaml
+
+[Install]
+WantedBy=multi-user.target
diff --git a/salt/profile/matrix/telegram.sls b/salt/profile/matrix/telegram.sls
new file mode 100644
index 0000000..1a076a0
--- /dev/null
+++ b/salt/profile/matrix/telegram.sls
@@ -0,0 +1,66 @@
+{% set roles = salt['grains.get']('roles', []) %}
+
+appservice_pgks:
+ pkg.installed:
+ - pkgs:
+ - python3-mautrix-telegram
+
+/var/lib/matrix-synapse/telegram:
+ file.directory:
+ - user: synapse
+
+telegram_conf_file:
+ file.managed:
+ - name: /var/lib/matrix-synapse/telegram/config.yaml
+ - source: salt://profile/matrix/files/config-telegram.yaml
+ - template: jinja
+ - user: synapse
+ - require:
+ - file: /var/lib/matrix-synapse/telegram
+ - require_in:
+ - service: telegram_service
+ - watch_in:
+ - module: telegram_restart
+
+telegram_appservice_file:
+ file.managed:
+ - name: /var/lib/matrix-synapse/telegram/telegram-registration.yaml
+ - source: salt://profile/matrix/files/appservice-telegram.yaml
+ - user: synapse
+ - template: jinja
+ - require:
+ - file: /var/lib/matrix-synapse/telegram
+ - watch_in:
+ - module: telegram_restart
+
+synapse_appservice_telegram_file:
+ file.managed:
+ - name: /etc/matrix-synapse/appservices/appservice-telegram.yaml
+ - source: salt://profile/matrix/files/appservice-telegram.yaml
+ - template: jinja
+ - require:
+ - file: /var/lib/matrix-synapse/telegram
+ - watch_in:
+ - module: telegram_restart
+
+telegram_systemd_file:
+ file.managed:
+ - name: /etc/systemd/system/telegram.service
+ - source: salt://profile/matrix/files/telegram.service
+ - require_in:
+ - service: telegram_service
+
+telegram_service:
+ service.running:
+ - name: telegram
+ - enable: True
+ - require:
+ - service: synapse_service
+
+telegram_restart:
+ module.wait:
+ - name: service.restart
+ - m_name: telegram
+ - require:
+ - service: synapse_service
+ - service: telegram_service
diff --git a/salt/role/matrix.sls b/salt/role/matrix.sls
index f13b35e..33bc29d 100644
--- a/salt/role/matrix.sls
+++ b/salt/role/matrix.sls
@@ -1,5 +1,6 @@
include:
- profile.matrix.synapse
- profile.matrix.init
- - profile.matrix.discord
+ - profile.matrix.appservice
+ - profile.matrix.telegram
- profile.matrix.config