Stasiek Michalski 3b66c9
# Homeserver details
Stasiek Michalski 3b66c9
homeserver:
Stasiek Michalski 3b66c9
    # The address that this appservice can use to connect to the homeserver.
Stasiek Michalski 3b66c9
    address: https://matrix.opensuse.org
Stasiek Michalski 3b66c9
    # The domain of the homeserver (for MXIDs, etc).
Stasiek Michalski 3b66c9
    domain: opensuse.org
Stasiek Michalski 3b66c9
    # Whether or not to verify the SSL certificate of the homeserver.
Stasiek Michalski 3b66c9
    # Only applies if address starts with https://
Stasiek Michalski 3b66c9
    verify_ssl: true
Stasiek Michalski d9b824
    asmux: false
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
# Application service host/registration related details
Stasiek Michalski 3b66c9
# Changing these values requires regeneration of the registration.
Stasiek Michalski 3b66c9
appservice:
Stasiek Michalski 3b66c9
    # The address that the homeserver can use to connect to this appservice.
Stasiek Michalski 3b66c9
    address: http://localhost:29317
Stasiek Michalski fbfc5d
    # When using https:// the TLS certificate and key files for the address.
Stasiek Michalski fbfc5d
    tls_cert: false
Stasiek Michalski fbfc5d
    tls_key: false
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # The hostname and port where this appservice should listen.
Stasiek Michalski 97438a
    hostname: 127.0.0.1
Stasiek Michalski 3b66c9
    port: 29317
Stasiek Michalski 3b66c9
    # The maximum body size of appservice API requests (from the homeserver) in mebibytes
Stasiek Michalski 3b66c9
    # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
Stasiek Michalski 3b66c9
    max_body_size: 1
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # The full URI to the database. SQLite and Postgres are fully supported.
Stasiek Michalski 3b66c9
    # Other DBMSes supported by SQLAlchemy may or may not work.
Stasiek Michalski 3b66c9
    # Format examples:
Stasiek Michalski 3b66c9
    #   SQLite:   sqlite:///filename.db
Stasiek Michalski 3b66c9
    #   Postgres: postgres://username:password@hostname/dbname
Stasiek Michalski c26b01
    database: postgresql://{{ pillar['profile']['matrix']['database_user'] }}:{{ pillar['postgres']['users']['matrix']['password'] }}@{{ pillar['profile']['matrix']['database_host'] }}/telegram_bridge
Stasiek Michalski d9b824
    # Optional extra arguments for SQLAlchemy's create_engine
Stasiek Michalski d9b824
    database_opts: {}
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Public part of web server for out-of-Matrix interaction with the bridge.
Stasiek Michalski 3b66c9
    # Used for things like login if the user wants to make sure the 2FA password isn't stored in
Stasiek Michalski 3b66c9
    # the HS database.
Stasiek Michalski 3b66c9
    public:
Stasiek Michalski 3b66c9
        # Whether or not the public-facing endpoints should be enabled.
Stasiek Michalski 3b66c9
        enabled: false
Stasiek Michalski 3b66c9
        # The prefix to use in the public-facing endpoints.
Stasiek Michalski 3b66c9
        prefix: /public
Stasiek Michalski 3b66c9
        # The base URL where the public-facing endpoints are available. The prefix is not added
Stasiek Michalski 3b66c9
        # implicitly.
Stasiek Michalski 3b66c9
        external: https://example.com/public
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Provisioning API part of the web server for automated portal creation and fetching information.
Stasiek Michalski d9b824
    # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
Stasiek Michalski 3b66c9
    provisioning:
Stasiek Michalski 3b66c9
        # Whether or not the provisioning API should be enabled.
Stasiek Michalski 3b66c9
        enabled: true
Stasiek Michalski 3b66c9
        # The prefix to use in the provisioning API endpoints.
Stasiek Michalski 3b66c9
        prefix: /_matrix/provision/v1
Stasiek Michalski 3b66c9
        # The shared secret to authorize users of the API.
Stasiek Michalski 3b66c9
        # Set to "generate" to generate and save a new token.
Stasiek Michalski 97438a
        shared_secret: {{ pillar['profile']['matrix']['telegram']['shared_secret'] }}
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # The unique ID of this appservice.
Stasiek Michalski 3b66c9
    id: {{ pillar['profile']['matrix']['telegram']['appservice_id'] }}
Stasiek Michalski 3b66c9
    # Username of the appservice bot.
Stasiek Michalski 3b66c9
    bot_username: telegrambot
Stasiek Michalski 3b66c9
    # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
Stasiek Michalski 3b66c9
    # to leave display name/avatar as-is.
Stasiek Michalski 3b66c9
    bot_displayname: Telegram
Stasiek Michalski fbfc5d
    bot_avatar: mxc://opensuse.org/FPGLmCfsZtwRHKeRITyGvtoQ
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Community ID for bridged users (changes registration file) and rooms.
Stasiek Michalski 3b66c9
    # Must be created manually.
Stasiek Michalski 3b66c9
    #
Stasiek Michalski 3b66c9
    # Example: "+telegram:example.com". Set to false to disable.
Stasiek Michalski 97438a
    community_id: +telegram:opensuse.org
Stasiek Michalski 3b66c9
Stasiek Michalski d9b824
    # Whether or not to receive ephemeral events via appservice transactions.
Stasiek Michalski d9b824
    # Requires MSC2409 support (i.e. Synapse 1.22+).
Stasiek Michalski d9b824
    # You should disable bridge -> sync_with_custom_puppets when this is enabled.
Stasiek Michalski d9b824
    ephemeral_events: false
Stasiek Michalski d9b824
Stasiek Michalski 3b66c9
    # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
Stasiek Michalski 97438a
    as_token: {{ pillar['profile']['matrix']['telegram']['appservice_token'] }}
Stasiek Michalski 97438a
    hs_token: {{ pillar['profile']['matrix']['telegram']['homeserver_token'] }}
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
# Prometheus telemetry config. Requires prometheus-client to be installed.
Stasiek Michalski fbfc5d
metrics:
Stasiek Michalski fbfc5d
    enabled: false
Stasiek Michalski fbfc5d
    listen_port: 8000
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
# Manhole config.
Stasiek Michalski c26b01
manhole:
Stasiek Michalski 3b66c9
    # Whether or not opening the manhole is allowed.
Stasiek Michalski fbfc5d
    enabled: false
Stasiek Michalski 3b66c9
    # The path for the unix socket.
Stasiek Michalski fbfc5d
    path: /var/tmp/mautrix-telegram.manhole
Stasiek Michalski 3b66c9
    # The list of UIDs who can be added to the whitelist.
Stasiek Michalski 3b66c9
    # If empty, any UIDs can be specified in the open-manhole command.
Stasiek Michalski fbfc5d
    whitelist:
Stasiek Michalski fbfc5d
    - 0
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
# Bridge config
Stasiek Michalski 3b66c9
bridge:
Stasiek Michalski 3b66c9
    # Localpart template of MXIDs for Telegram users.
Stasiek Michalski 3b66c9
    # {userid} is replaced with the user ID of the Telegram user.
Stasiek Michalski 97438a
    username_template: telegram_{userid}
Stasiek Michalski 3b66c9
    # Localpart template of room aliases for Telegram portal rooms.
Stasiek Michalski 3b66c9
    # {groupname} is replaced with the name part of the public channel/group invite link ( https://t.me/{} )
Stasiek Michalski 97438a
    alias_template: telegram_{groupname}
Stasiek Michalski 3b66c9
    # Displayname template for Telegram users.
Stasiek Michalski 3b66c9
    # {displayname} is replaced with the display name of the Telegram user.
Stasiek Michalski 235425
    displayname_template: '{displayname}'
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Set the preferred order of user identifiers which to use in the Matrix puppet display name.
Stasiek Michalski 3b66c9
    # In the (hopefully unlikely) scenario that none of the given keys are found, the numeric user
Stasiek Michalski 3b66c9
    # ID is used.
Stasiek Michalski 3b66c9
    #
Stasiek Michalski 3b66c9
    # If the bridge is working properly, a phone number or an username should always be known, but
Stasiek Michalski 3b66c9
    # the other one can very well be empty.
Stasiek Michalski 3b66c9
    #
Stasiek Michalski 3b66c9
    # Valid keys:
Stasiek Michalski 3b66c9
    #   "full name"          (First and/or last name)
Stasiek Michalski 3b66c9
    #   "full name reversed" (Last and/or first name)
Stasiek Michalski 3b66c9
    #   "first name"
Stasiek Michalski 3b66c9
    #   "last name"
Stasiek Michalski 3b66c9
    #   "username"
Stasiek Michalski 3b66c9
    #   "phone number"
Stasiek Michalski 3b66c9
    displayname_preference:
Stasiek Michalski 3b66c9
    - full name
Stasiek Michalski 3b66c9
    - username
Stasiek Michalski 3b66c9
    - phone number
Stasiek Michalski 3b66c9
    # Maximum length of displayname
Stasiek Michalski 3b66c9
    displayname_max_length: 100
Stasiek Michalski fbfc5d
    # Remove avatars from Telegram ghost users when removed on Telegram. This is disabled by default
Stasiek Michalski fbfc5d
    # as there's no way to determine whether an avatar is removed or just hidden from some users. If
Stasiek Michalski fbfc5d
    # you're on a single-user instance, this should be safe to enable.
Stasiek Michalski fbfc5d
    allow_avatar_remove: false
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Maximum number of members to sync per portal when starting up. Other members will be
Stasiek Michalski 3b66c9
    # synced when they send messages. The maximum is 10000, after which the Telegram server
Stasiek Michalski 3b66c9
    # will not send any more members.
Stasiek Michalski d9b824
    # -1 means no limit (which means it's limited to 10000 by the server)
Stasiek Michalski 3b66c9
    max_initial_member_sync: -1
Stasiek Michalski 3b66c9
    # Whether or not to sync the member list in channels.
Stasiek Michalski 3b66c9
    # If no channel admins have logged into the bridge, the bridge won't be able to sync the member
Stasiek Michalski 3b66c9
    # list regardless of this setting.
Stasiek Michalski 3b66c9
    sync_channel_members: true
Stasiek Michalski 3b66c9
    # Whether or not to skip deleted members when syncing members.
Stasiek Michalski 3b66c9
    skip_deleted_members: true
Stasiek Michalski 3b66c9
    # Whether or not to automatically synchronize contacts and chats of Matrix users logged into
Stasiek Michalski 3b66c9
    # their Telegram account at startup.
Stasiek Michalski 3b66c9
    startup_sync: true
Stasiek Michalski 3b66c9
    # Number of most recently active dialogs to check when syncing chats.
Stasiek Michalski 3b66c9
    # Set to 0 to remove limit.
Stasiek Michalski d9b824
    sync_update_limit: 30
Stasiek Michalski d9b824
    # Number of most recently active dialogs to create portals for when syncing chats.
Stasiek Michalski d9b824
    # Set to 0 to remove limit.
Stasiek Michalski d9b824
    sync_create_limit: 30
Stasiek Michalski 3b66c9
    # Whether or not to sync and create portals for direct chats at startup.
Stasiek Michalski 3b66c9
    sync_direct_chats: false
Stasiek Michalski 3b66c9
    # The maximum number of simultaneous Telegram deletions to handle.
Stasiek Michalski 3b66c9
    # A large number of simultaneous redactions could put strain on your homeserver.
Stasiek Michalski 3b66c9
    max_telegram_delete: 10
Stasiek Michalski 3b66c9
    # Whether or not to automatically sync the Matrix room state (mostly unpuppeted displaynames)
Stasiek Michalski 3b66c9
    # at startup and when creating a bridge.
Stasiek Michalski 3b66c9
    sync_matrix_state: true
Stasiek Michalski d9b824
    # Allow logging in within Matrix. If false, users can only log in using login-qr or the
Stasiek Michalski d9b824
    # out-of-Matrix login website (see appservice.public config section)
Stasiek Michalski 3b66c9
    allow_matrix_login: true
Stasiek Michalski 3b66c9
    # Whether or not to bridge plaintext highlights.
Stasiek Michalski 3b66c9
    # Only enable this if your displayname_template has some static part that the bridge can use to
Stasiek Michalski 3b66c9
    # reliably identify what is a plaintext highlight.
Stasiek Michalski 3b66c9
    plaintext_highlights: false
Stasiek Michalski 3b66c9
    # Whether or not to make portals of publicly joinable channels/supergroups publicly joinable on Matrix.
Stasiek Michalski 3b66c9
    public_portals: false
Stasiek Michalski d9b824
    # Whether or not to use /sync to get presence, read receipts and typing notifications
Stasiek Michalski d9b824
    # when double puppeting is enabled
Stasiek Michalski 3b66c9
    sync_with_custom_puppets: true
Stasiek Michalski d9b824
    # Whether or not to update the m.direct account data event when double puppeting is enabled.
Stasiek Michalski d9b824
    # Note that updating the m.direct event is not atomic (except with mautrix-asmux)
Stasiek Michalski d9b824
    # and is therefore prone to race conditions.
Stasiek Michalski d9b824
    sync_direct_chat_list: false
Stasiek Michalski d9b824
    # Servers to always allow double puppeting from
Stasiek Michalski d9b824
    double_puppet_server_map:
Stasiek Michalski d9b824
        example.com: https://example.com
Stasiek Michalski d9b824
    # Allow using double puppeting from any server with a valid client .well-known file.
Stasiek Michalski d9b824
    double_puppet_allow_discovery: false
Stasiek Michalski d9b824
    # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
Stasiek Michalski 3b66c9
    #
Stasiek Michalski 3b66c9
    # If set, custom puppets will be enabled automatically for local users
Stasiek Michalski 3b66c9
    # instead of users having to find an access token and run `login-matrix`
Stasiek Michalski 3b66c9
    # manually.
Stasiek Michalski d9b824
    # If using this for other servers than the bridge's server,
Stasiek Michalski d9b824
    # you must also set the URL in the double_puppet_server_map.
Stasiek Michalski d9b824
    login_shared_secret_map:
Stasiek Michalski d9b824
        example.com: foobar
Stasiek Michalski 3b66c9
    # Set to false to disable link previews in messages sent to Telegram.
Stasiek Michalski 3b66c9
    telegram_link_preview: true
Stasiek Michalski 3b66c9
    # Use inline images instead of a separate message for the caption.
Stasiek Michalski 3b66c9
    # N.B. Inline images are not supported on all clients (e.g. Riot iOS).
Stasiek Michalski 97438a
    inline_images: true
Stasiek Michalski 3b66c9
    # Maximum size of image in megabytes before sending to Telegram as a document.
Stasiek Michalski 3b66c9
    image_as_file_size: 10
Stasiek Michalski 3b66c9
    # Maximum size of Telegram documents in megabytes to bridge.
Stasiek Michalski 3b66c9
    max_document_size: 100
Stasiek Michalski 3b66c9
    # Enable experimental parallel file transfer, which makes uploads/downloads much faster by
Stasiek Michalski 3b66c9
    # streaming from/to Matrix and using many connections for Telegram.
Stasiek Michalski 3b66c9
    # Note that generating HQ thumbnails for videos is not possible with streamed transfers.
Stasiek Michalski 3b66c9
    parallel_file_transfer: false
Stasiek Michalski 3b66c9
    # Whether or not created rooms should have federation enabled.
Stasiek Michalski 3b66c9
    # If false, created portal rooms will never be federated.
Stasiek Michalski 3b66c9
    federate_rooms: true
Stasiek Michalski 3b66c9
    # Settings for converting animated stickers.
Stasiek Michalski 3b66c9
    animated_sticker:
Stasiek Michalski 3b66c9
        # Format to which animated stickers should be converted.
Stasiek Michalski 3b66c9
        # disable - No conversion, send as-is (gzipped lottie)
Stasiek Michalski 3b66c9
        # png - converts to non-animated png (fastest),
Stasiek Michalski 3b66c9
        # gif - converts to animated gif, but loses transparency
Stasiek Michalski 3b66c9
        # webm - converts to webm video, requires ffmpeg executable with vp9 codec and webm container support
Stasiek Michalski 3b66c9
        target: webm
Stasiek Michalski 3b66c9
        # Arguments for converter. All converters take width and height.
Stasiek Michalski 3b66c9
        # GIF converter takes background as a hex color.
Stasiek Michalski 3b66c9
        args:
Stasiek Michalski 3b66c9
            width: 256
Stasiek Michalski 3b66c9
            height: 256
Stasiek Michalski 3b66c9
            fps: 30
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Overrides for base power levels.
Stasiek Michalski fbfc5d
    encryption:
Stasiek Michalski fbfc5d
        # Allow encryption, work in group chat rooms with e2ee enabled
Stasiek Michalski fbfc5d
        allow: false
Stasiek Michalski fbfc5d
        # Default to encryption, force-enable encryption in all portals the bridge creates
Stasiek Michalski fbfc5d
        # This will cause the bridge bot to be in private chats for the encryption to work properly.
Stasiek Michalski fbfc5d
        default: false
Stasiek Michalski d9b824
        # Database for the encryption data. Currently only supports Postgres and an in-memory
Stasiek Michalski d9b824
        # store that's persisted as a pickle.
Stasiek Michalski d9b824
        # If set to `default`, will use the appservice postgres database
Stasiek Michalski d9b824
        # or a pickle file if the appservice database is sqlite.
Stasiek Michalski d9b824
        #
Stasiek Michalski d9b824
        # Format examples:
Stasiek Michalski d9b824
        #   Pickle:   pickle:///filename.pickle
Stasiek Michalski d9b824
        #   Postgres: postgres://username:password@hostname/dbname
Stasiek Michalski d9b824
        database: default
Stasiek Michalski d9b824
        # Options for automatic key sharing.
Stasiek Michalski d9b824
        key_sharing:
Stasiek Michalski d9b824
            # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
Stasiek Michalski d9b824
            # You must use a client that supports requesting keys from other users to use this feature.
Stasiek Michalski d9b824
            allow: false
Stasiek Michalski d9b824
            # Require the requesting device to have a valid cross-signing signature?
Stasiek Michalski d9b824
            # This doesn't require that the bridge has verified the device, only that the user has verified it.
Stasiek Michalski d9b824
            # Not yet implemented.
Stasiek Michalski d9b824
            require_cross_signing: false
Stasiek Michalski d9b824
            # Require devices to be verified by the bridge?
Stasiek Michalski d9b824
            # Verification by the bridge is not yet implemented.
Stasiek Michalski d9b824
            require_verification: tru
Stasiek Michalski fbfc5d
    # Whether or not to explicitly set the avatar and room name for private
Stasiek Michalski fbfc5d
    # chat portal rooms. This will be implicitly enabled if encryption.default is true.
Stasiek Michalski fbfc5d
    private_chat_portal_meta: false
Stasiek Michalski fbfc5d
    # Whether or not the bridge should send a read receipt from the bridge bot when a message has
Stasiek Michalski fbfc5d
    # been sent to Telegram.
Stasiek Michalski fbfc5d
    delivery_receipts: false
Stasiek Michalski fbfc5d
    # Whether or not delivery errors should be reported as messages in the Matrix room.
Stasiek Michalski fbfc5d
    delivery_error_reports: false
Stasiek Michalski d9b824
    # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
Stasiek Michalski d9b824
    # This field will automatically be changed back to false after it,
Stasiek Michalski d9b824
    # except if the config file is not writable.
Stasiek Michalski d9b824
    resend_bridge_info: false
Stasiek Michalski d9b824
    # Settings for backfilling messages from Telegram.
Stasiek Michalski d9b824
    backfill:
Stasiek Michalski d9b824
        # Whether or not the Telegram ghosts of logged in Matrix users should be
Stasiek Michalski d9b824
        # invited to private chats when backfilling history from Telegram. This is
Stasiek Michalski d9b824
        # usually needed to prevent rate limits and to allow timestamp massaging.
Stasiek Michalski d9b824
        invite_own_puppet: true
Stasiek Michalski d9b824
        # Maximum number of messages to backfill without using a takeout.
Stasiek Michalski d9b824
        # The first time a takeout is used, the user has to manually approve it from a different
Stasiek Michalski d9b824
        # device. If initial_limit or missed_limit are higher than this value, the bridge will ask
Stasiek Michalski d9b824
        # the user to accept the takeout after logging in before syncing any chats.
Stasiek Michalski d9b824
        takeout_limit: 100
Stasiek Michalski d9b824
        # Maximum number of messages to backfill initially.
Stasiek Michalski d9b824
        # Set to 0 to disable backfilling when creating portal, or -1 to disable the limit.
Stasiek Michalski d9b824
        #
Stasiek Michalski d9b824
        # N.B. Initial backfill will only start after member sync. Make sure your
Stasiek Michalski d9b824
        #      max_initial_member_sync is set to a low enough value so it doesn't take forever.
Stasiek Michalski d9b824
        initial_limit: 0
Stasiek Michalski d9b824
        # Maximum number of messages to backfill if messages were missed while the bridge was
Stasiek Michalski d9b824
        # disconnected. Note that this only works for logged in users and only if the chat isn't
Stasiek Michalski d9b824
        # older than sync_update_limit
Stasiek Michalski d9b824
        # Set to 0 to disable backfilling missed messages.
Stasiek Michalski d9b824
        missed_limit: 50
Stasiek Michalski d9b824
        # If using double puppeting, should notifications be disabled
Stasiek Michalski d9b824
        # while the initial backfill is in progress?
Stasiek Michalski d9b824
        disable_notifications: false
Stasiek Michalski d9b824
        # Whether or not to enable backfilling in normal groups.
Stasiek Michalski d9b824
        # Normal groups have numerous technical problems in Telegram, and backfilling normal groups
Stasiek Michalski d9b824
        # will likely cause problems if there are multiple Matrix users in the group.
Stasiek Michalski d9b824
        normal_groups: false
Stasiek Michalski d9b824
Stasiek Michalski fbfc5d
Stasiek Michalski fbfc5d
    # Overrides for base power levels.
Stasiek Michalski 3b66c9
    initial_power_level_overrides:
Stasiek Michalski 3b66c9
        user: {}
Stasiek Michalski 3b66c9
        group: {}
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Whether to bridge Telegram bot messages as m.notices or m.texts.
Stasiek Michalski 3b66c9
    bot_messages_as_notices: true
Stasiek Michalski 3b66c9
    bridge_notices:
Stasiek Michalski 3b66c9
        # Whether or not Matrix bot messages (type m.notice) should be bridged.
Sasi Olin 7fa55e
        default: true
Stasiek Michalski 3b66c9
        # List of user IDs for whom the previous flag is flipped.
Stasiek Michalski 3b66c9
        # e.g. if bridge_notices.default is false, notices from other users will not be bridged, but
Stasiek Michalski 3b66c9
        #      notices from users listed here will be bridged.
Stasiek Michalski 3b66c9
        # exceptions:
Stasiek Michalski 3b66c9
        # - "@importantbot:example.com"
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Some config options related to Telegram message deduplication.
Stasiek Michalski 3b66c9
    # The default values are usually fine, but some debug messages/warnings might recommend you
Stasiek Michalski 3b66c9
    # change these.
Stasiek Michalski 3b66c9
    deduplication:
Stasiek Michalski 3b66c9
        # Whether or not to check the database if the message about to be sent is a duplicate.
Stasiek Michalski 3b66c9
        pre_db_check: false
Stasiek Michalski 3b66c9
        # The number of latest events to keep when checking for duplicates.
Stasiek Michalski 3b66c9
        # You might need to increase this on high-traffic bridge instances.
Stasiek Michalski 3b66c9
        cache_queue_length: 20
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # The formats to use when sending messages to Telegram via the relay bot.
Stasiek Michalski 3b66c9
    # Text msgtypes (m.text, m.notice and m.emote) support HTML, media msgtypes don't.
Stasiek Michalski 3b66c9
    #
Stasiek Michalski 3b66c9
    # Available variables:
Stasiek Michalski 3b66c9
    #   $sender_displayname - The display name of the sender (e.g. Example User)
Stasiek Michalski 3b66c9
    #   $sender_username    - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
Stasiek Michalski 3b66c9
    #   $sender_mxid        - The Matrix ID of the sender (e.g. @exampleuser:example.com)
Stasiek Michalski 3b66c9
    #   $message            - The message content
Stasiek Michalski 3b66c9
    message_formats:
Stasiek Michalski 97438a
        m.text: '$sender_displayname: $message'
Stasiek Michalski 97438a
        m.notice: '$sender_displayname: $message'
Stasiek Michalski 97438a
        m.emote: '* $sender_displayname $message'
Stasiek Michalski 97438a
        m.file: '$sender_displayname sent a file: $message'
Stasiek Michalski 97438a
        m.image: '$sender_displayname sent an image: $message'
Stasiek Michalski 97438a
        m.audio: '$sender_displayname sent an audio file: $message'
Stasiek Michalski 97438a
        m.video: '$sender_displayname sent a video: $message'
Stasiek Michalski 97438a
        m.location: '$sender_displayname sent a location: $message'
Stasiek Michalski 3b66c9
    # Telegram doesn't have built-in emotes, this field specifies how m.emote's from authenticated
Stasiek Michalski 3b66c9
    # users are sent to telegram. All fields in message_formats are supported. Additionally, the
Stasiek Michalski 3b66c9
    # Telegram user info is available in the following variables:
Stasiek Michalski 3b66c9
    #    $displayname - Telegram displayname
Stasiek Michalski 3b66c9
    #    $username    - Telegram username (may not exist)
Stasiek Michalski 3b66c9
    #    $mention     - Telegram @username or displayname mention (depending on which exists)
Stasiek Michalski 97438a
    emote_format: '* $mention $formatted_body'
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # The formats to use when sending state events to Telegram via the relay bot.
Stasiek Michalski 3b66c9
    #
Stasiek Michalski 3b66c9
    # Variables from `message_formats` that have the `sender_` prefix are available without the prefix.
Stasiek Michalski 3b66c9
    # In name_change events, `$prev_displayname` is the previous displayname.
Stasiek Michalski 3b66c9
    #
Stasiek Michalski 3b66c9
    # Set format to an empty string to disable the messages for that event.
Stasiek Michalski 3b66c9
    state_event_formats:
Stasiek Michalski 97438a
        join: ''
Stasiek Michalski 97438a
        leave: ''
Stasiek Michalski 97438a
        name_change: ''
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Filter rooms that can/can't be bridged. Can also be managed using the `filter` and
Stasiek Michalski 3b66c9
    # `filter-mode` management commands.
Stasiek Michalski 3b66c9
    #
Stasiek Michalski 3b66c9
    # Filters do not affect direct chats.
Stasiek Michalski 3b66c9
    # An empty blacklist will essentially disable the filter.
Stasiek Michalski 3b66c9
    filter:
Stasiek Michalski 3b66c9
        # Filter mode to use. Either "blacklist" or "whitelist".
Stasiek Michalski 3b66c9
        # If the mode is "blacklist", the listed chats will never be bridged.
Stasiek Michalski 3b66c9
        # If the mode is "whitelist", only the listed chats can be bridged.
Stasiek Michalski 3b66c9
        mode: blacklist
Stasiek Michalski 3b66c9
        # The list of group/channel IDs to filter.
Stasiek Michalski 3b66c9
        list: []
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # The prefix for commands. Only required in non-management rooms.
Stasiek Michalski 97438a
    command_prefix: '!tg'
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Permissions for using the bridge.
Stasiek Michalski 3b66c9
    # Permitted values:
Stasiek Michalski 3b66c9
    #   relaybot - Only use the bridge via the relaybot, no access to commands.
Stasiek Michalski 3b66c9
    #       user - Relaybot level + access to commands to create bridges.
Stasiek Michalski 3b66c9
    #  puppeting - User level + logging in with a Telegram account.
Stasiek Michalski 3b66c9
    #       full - Full access to use the bridge, i.e. previous levels + Matrix login.
Stasiek Michalski 3b66c9
    #      admin - Full access to use the bridge and some extra administration commands.
Stasiek Michalski 3b66c9
    # Permitted keys:
Stasiek Michalski 3b66c9
    #        * - All Matrix users
Stasiek Michalski 3b66c9
    #   domain - All users on that homeserver
Stasiek Michalski 3b66c9
    #     mxid - Specific user
Stasiek Michalski 3b66c9
    permissions:
Stasiek Michalski fbfc5d
        '*': relaybot
Stasiek Michalski fbfc5d
        '@hellcp:opensuse.org': admin
Stasiek Michalski d9b824
        '@pontaoski:tchncs.de': admin
Stasiek Michalski d9b824
        '@carl:kde.org': user
Stasiek Michalski 3b66c9
    relaybot:
Stasiek Michalski 3b66c9
        private_chat:
Stasiek Michalski 3b66c9
            # List of users to invite to the portal when someone starts a private chat with the bot.
Stasiek Michalski 3b66c9
            # If empty, private chats with the bot won't create a portal.
Stasiek Michalski 3b66c9
            invite: []
Stasiek Michalski 3b66c9
            # Whether or not to bridge state change messages in relaybot private chats.
Stasiek Michalski 3b66c9
            state_changes: true
Stasiek Michalski 3b66c9
            # When private_chat_invite is empty, this message is sent to users /starting the
Stasiek Michalski 3b66c9
            # relaybot. Telegram's "markdown" is supported.
Stasiek Michalski 3b66c9
            message: This is a Matrix bridge relaybot and does not support direct chats
Stasiek Michalski 3b66c9
        # List of users to invite to all group chat portals created by the bridge.
Stasiek Michalski 3b66c9
        group_chat_invite: []
Stasiek Michalski 3b66c9
        # Whether or not the relaybot should not bridge events in unbridged group chats.
Stasiek Michalski 3b66c9
        # If false, portals will be created when the relaybot receives messages, just like normal
Stasiek Michalski 3b66c9
        # users. This behavior is usually not desirable, as it interferes with manually bridging
Stasiek Michalski 3b66c9
        # the chat to another room.
Stasiek Michalski 3b66c9
        ignore_unbridged_group_chat: true
Stasiek Michalski 3b66c9
        # Whether or not to allow creating portals from Telegram.
Stasiek Michalski 3b66c9
        authless_portals: true
Stasiek Michalski 3b66c9
        # Whether or not to allow Telegram group admins to use the bot commands.
Stasiek Michalski 3b66c9
        whitelist_group_admins: true
Stasiek Michalski 3b66c9
        # Whether or not to ignore incoming events sent by the relay bot.
Stasiek Michalski 3b66c9
        ignore_own_incoming_events: true
Stasiek Michalski 3b66c9
        # List of usernames/user IDs who are also allowed to use the bot commands.
Stasiek Michalski fbfc5d
        whitelist:
Stasiek Michalski fbfc5d
        # - myusername
Stasiek Michalski fbfc5d
        # - 12345678
Stasiek Michalski fbfc5d
Stasiek Michalski 3b66c9
# Telegram config
Stasiek Michalski 3b66c9
telegram:
Stasiek Michalski 3b66c9
    # Get your own API keys at https://my.telegram.org/apps
Stasiek Michalski 3b66c9
    api_id: {{ pillar['profile']['matrix']['telegram']['api_id'] }}
Stasiek Michalski 3b66c9
    api_hash: {{ pillar['profile']['matrix']['telegram']['api_hash'] }}
Stasiek Michalski 3b66c9
    # (Optional) Create your own bot at https://t.me/BotFather
Stasiek Michalski 3b66c9
    bot_token: {{ pillar['profile']['matrix']['telegram']['bot_token'] }}
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Telethon connection options.
Stasiek Michalski 3b66c9
    connection:
Stasiek Michalski 3b66c9
        # The timeout in seconds to be used when connecting.
Stasiek Michalski 3b66c9
        timeout: 120
Stasiek Michalski 3b66c9
        # How many times the reconnection should retry, either on the initial connection or when
Stasiek Michalski 3b66c9
        # Telegram disconnects us. May be set to a negative or null value for infinite retries, but
Stasiek Michalski 3b66c9
        # this is not recommended, since the program can get stuck in an infinite loop.
Stasiek Michalski 3b66c9
        retries: 5
Stasiek Michalski 3b66c9
        # The delay in seconds to sleep between automatic reconnections.
Stasiek Michalski 3b66c9
        retry_delay: 1
Stasiek Michalski 3b66c9
        # The threshold below which the library should automatically sleep on flood wait errors
Stasiek Michalski 3b66c9
        # (inclusive). For instance, if a FloodWaitError for 17s occurs and flood_sleep_threshold
Stasiek Michalski 3b66c9
        # is 20s, the library will sleep automatically. If the error was for 21s, it would raise
Stasiek Michalski 3b66c9
        # the error instead. Values larger than a day (86400) will be changed to a day.
Stasiek Michalski 3b66c9
        flood_sleep_threshold: 60
Stasiek Michalski 3b66c9
        # How many times a request should be retried. Request are retried when Telegram is having
Stasiek Michalski 3b66c9
        # internal issues, when there is a FloodWaitError less than flood_sleep_threshold, or when
Stasiek Michalski 3b66c9
        # there's a migrate error. May take a negative or null value for infinite retries, but this
Stasiek Michalski 3b66c9
        # is not recommended, since some requests can always trigger a call fail (such as searching
Stasiek Michalski 3b66c9
        # for messages).
Stasiek Michalski 3b66c9
        request_retries: 5
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Device info sent to Telegram.
Stasiek Michalski 3b66c9
    device_info:
Stasiek Michalski 3b66c9
        # "auto" = OS name+version.
Stasiek Michalski 3b66c9
        device_model: auto
Stasiek Michalski 3b66c9
        # "auto" = Telethon version.
Stasiek Michalski 3b66c9
        system_version: auto
Stasiek Michalski 3b66c9
        # "auto" = mautrix-telegram version.
Stasiek Michalski 3b66c9
        app_version: auto
Stasiek Michalski 3b66c9
        lang_code: en
Stasiek Michalski 3b66c9
        system_lang_code: en
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Custom server to connect to.
Stasiek Michalski 3b66c9
    server:
Stasiek Michalski 3b66c9
        # Set to true to use these server settings. If false, will automatically
Stasiek Michalski 3b66c9
        # use production server assigned by Telegram. Set to false in production.
Stasiek Michalski 3b66c9
        enabled: false
Stasiek Michalski 3b66c9
        # The DC ID to connect to.
Stasiek Michalski 3b66c9
        dc: 2
Stasiek Michalski 3b66c9
        # The IP to connect to.
Stasiek Michalski 3b66c9
        ip: 149.154.167.40
Stasiek Michalski 3b66c9
        # The port to connect to. 443 may not work, 80 is better and both are equally secure.
Stasiek Michalski 3b66c9
        port: 80
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
    # Telethon proxy configuration.
Stasiek Michalski 3b66c9
    # You must install PySocks from pip for proxies to work.
Stasiek Michalski 3b66c9
    proxy:
Stasiek Michalski 3b66c9
        # Allowed types: disabled, socks4, socks5, http, mtproxy
Stasiek Michalski 3b66c9
        type: disabled
Stasiek Michalski 3b66c9
        # Proxy IP address and port.
Stasiek Michalski 3b66c9
        address: 127.0.0.1
Stasiek Michalski 3b66c9
        port: 1080
Stasiek Michalski 3b66c9
        # Whether or not to perform DNS resolving remotely. Only for socks/http proxies.
Stasiek Michalski 3b66c9
        rdns: true
Stasiek Michalski 3b66c9
        # Proxy authentication (optional). Put MTProxy secret in password field.
Stasiek Michalski fbfc5d
        username: ''
Stasiek Michalski fbfc5d
        password: ''
Stasiek Michalski 3b66c9
Stasiek Michalski 3b66c9
# Python logging configuration.
Stasiek Michalski 3b66c9
#
Stasiek Michalski 3b66c9
# See section 16.7.2 of the Python documentation for more info:
Stasiek Michalski 3b66c9
# https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
Stasiek Michalski 3b66c9
logging:
Stasiek Michalski 3b66c9
    version: 1
Stasiek Michalski 3b66c9
    formatters:
Stasiek Michalski 3b66c9
        colored:
Stasiek Michalski 3b66c9
            (): mautrix_telegram.util.ColorFormatter
Stasiek Michalski 97438a
            format: '[%(asctime)s] [%(levelname)s@%(name)s] %(message)s'
Stasiek Michalski 3b66c9
        normal:
Stasiek Michalski 97438a
            format: '[%(asctime)s] [%(levelname)s@%(name)s] %(message)s'
Stasiek Michalski 3b66c9
    handlers:
Stasiek Michalski 3b66c9
        file:
Stasiek Michalski 3b66c9
            class: logging.handlers.RotatingFileHandler
Stasiek Michalski 3b66c9
            formatter: normal
Stasiek Michalski 80833e
            filename: /var/log/matrix-synapse/telegram/mautrix-telegram.log
Stasiek Michalski 3b66c9
            maxBytes: 10485760
Stasiek Michalski 3b66c9
            backupCount: 10
Stasiek Michalski 3b66c9
        console:
Stasiek Michalski 3b66c9
            class: logging.StreamHandler
Stasiek Michalski 3b66c9
            formatter: colored
Stasiek Michalski 3b66c9
    loggers:
Stasiek Michalski 3b66c9
        mau:
Stasiek Michalski 3b66c9
            level: DEBUG
Stasiek Michalski 3b66c9
        telethon:
Stasiek Michalski 3b66c9
            level: INFO
Stasiek Michalski 3b66c9
        aiohttp:
Stasiek Michalski 3b66c9
            level: INFO
Stasiek Michalski 3b66c9
    root:
Stasiek Michalski 3b66c9
        level: DEBUG
Stasiek Michalski 3b66c9
        handlers: [file, console]