Matrix Docker Ansible eploy
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

473 linhas
23 KiB

  1. # mautrix-telegram is a Matrix <-> Telegram bridge
  2. # See: https://github.com/tulir/mautrix-telegram
  3. matrix_mautrix_telegram_enabled: true
  4. # See: https://mau.dev/tulir/mautrix-telegram/container_registry
  5. matrix_mautrix_telegram_docker_image: "dock.mau.dev/tulir/mautrix-telegram:v0.7.0"
  6. matrix_mautrix_telegram_docker_image_force_pull: "{{ matrix_mautrix_telegram_docker_image.endswith(':latest') }}"
  7. matrix_mautrix_telegram_base_path: "{{ matrix_base_data_path }}/mautrix-telegram"
  8. matrix_mautrix_telegram_config_path: "{{ matrix_mautrix_telegram_base_path }}/config"
  9. matrix_mautrix_telegram_data_path: "{{ matrix_mautrix_telegram_base_path }}/data"
  10. # Get your own API keys at https://my.telegram.org/apps
  11. matrix_mautrix_telegram_api_id: ''
  12. matrix_mautrix_telegram_api_hash: ''
  13. matrix_mautrix_telegram_bot_token: disabled
  14. # Mautrix telegram public endpoint to log in to telegram
  15. # Use an uuid so it's not easily discoverable.
  16. # Example: /741a0483-ba17-4682-9900-30bd7269f1cc
  17. matrix_mautrix_telegram_public_endpoint: ''
  18. matrix_mautrix_telegram_homeserver_address: 'http://matrix-synapse:8008'
  19. matrix_mautrix_telegram_homeserver_domain: '{{ matrix_domain }}'
  20. matrix_mautrix_telegram_appservice_address: 'http://matrix-mautrix-telegram:8080'
  21. matrix_mautrix_telegram_appservice_public_external: 'https://{{ matrix_server_fqn_matrix }}{{ matrix_mautrix_telegram_public_endpoint }}'
  22. # Controls whether the matrix-telegram container exposes its HTTP port (tcp/8080 in the container).
  23. #
  24. # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9006"), or empty string to not expose.
  25. matrix_mautrix_telegram_container_http_host_bind_port: ''
  26. # A list of extra arguments to pass to the container
  27. matrix_mautrix_telegram_container_extra_arguments: []
  28. # List of systemd services that matrix-mautrix-telegram.service depends on.
  29. matrix_mautrix_telegram_systemd_required_services_list: ['docker.service']
  30. # List of systemd services that matrix-mautrix-telegram.service wants
  31. matrix_mautrix_telegram_systemd_wanted_services_list: []
  32. matrix_mautrix_telegram_appservice_token: ''
  33. matrix_mautrix_telegram_homeserver_token: ''
  34. # Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
  35. matrix_mautrix_telegram_login_shared_secret: ''
  36. # Default configuration template which covers the generic use case.
  37. # You can customize it by controlling the various variables inside it.
  38. #
  39. # For a more advanced customization, you can extend the default (see `matrix_mautrix_telegram_configuration_extension_yaml`)
  40. # or completely replace this variable with your own template.
  41. matrix_mautrix_telegram_configuration_yaml: |
  42. #jinja2: lstrip_blocks: "True"
  43. # Homeserver details
  44. homeserver:
  45. # The address that this appservice can use to connect to the homeserver.
  46. address: {{ matrix_mautrix_telegram_homeserver_address }}
  47. # The domain of the homeserver (for MXIDs, etc).
  48. domain: {{ matrix_mautrix_telegram_homeserver_domain }}
  49. # Whether or not to verify the SSL certificate of the homeserver.
  50. # Only applies if address starts with https://
  51. verify_ssl: true
  52. # Application service host/registration related details
  53. # Changing these values requires regeneration of the registration.
  54. appservice:
  55. # The address that the homeserver can use to connect to this appservice.
  56. address: {{ matrix_mautrix_telegram_appservice_address }}
  57. # The hostname and port where this appservice should listen.
  58. hostname: 0.0.0.0
  59. port: 8080
  60. # The maximum body size of appservice API requests (from the homeserver) in mebibytes
  61. # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
  62. max_body_size: 1
  63. # The full URI to the database. SQLite and Postgres are fully supported.
  64. # Other DBMSes supported by SQLAlchemy may or may not work.
  65. # Format examples:
  66. # SQLite: sqlite:///filename.db
  67. # Postgres: postgres://username:password@hostname/dbname
  68. database: sqlite:////data/mautrix-telegram.db
  69. # Public part of web server for out-of-Matrix interaction with the bridge.
  70. # Used for things like login if the user wants to make sure the 2FA password isn't stored in
  71. # the HS database.
  72. public:
  73. # Whether or not the public-facing endpoints should be enabled.
  74. enabled: true
  75. # The prefix to use in the public-facing endpoints.
  76. prefix: {{ matrix_mautrix_telegram_public_endpoint }}
  77. # The base URL where the public-facing endpoints are available. The prefix is not added
  78. # implicitly.
  79. external: {{ matrix_mautrix_telegram_appservice_public_external }}
  80. # Provisioning API part of the web server for automated portal creation and fetching information.
  81. # Used by things like Dimension (https://dimension.t2bot.io/).
  82. provisioning:
  83. # Whether or not the provisioning API should be enabled.
  84. enabled: false
  85. # The prefix to use in the provisioning API endpoints.
  86. prefix: /_matrix/provision/v1
  87. # The shared secret to authorize users of the API.
  88. # Set to "generate" to generate and save a new token.
  89. shared_secret: generate
  90. # The unique ID of this appservice.
  91. id: telegram
  92. # Username of the appservice bot.
  93. bot_username: telegrambot
  94. # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
  95. # to leave display name/avatar as-is.
  96. bot_displayname: Telegram bridge bot
  97. bot_avatar: mxc://maunium.net/tJCRmUyJDsgRNgqhOgoiHWbX
  98. # Authentication tokens for AS <-> HS communication.
  99. as_token: "{{ matrix_mautrix_telegram_appservice_token }}"
  100. hs_token: "{{ matrix_mautrix_telegram_homeserver_token }}"
  101. # Bridge config
  102. bridge:
  103. # Localpart template of MXIDs for Telegram users.
  104. # {userid} is replaced with the user ID of the Telegram user.
  105. username_template: "telegram_{userid}"
  106. # Localpart template of room aliases for Telegram portal rooms.
  107. # {groupname} is replaced with the name part of the public channel/group invite link ( https://t.me/{} )
  108. alias_template: "telegram_{groupname}"
  109. # Displayname template for Telegram users.
  110. # {displayname} is replaced with the display name of the Telegram user.
  111. displayname_template: "{displayname} (Telegram)"
  112. # Set the preferred order of user identifiers which to use in the Matrix puppet display name.
  113. # In the (hopefully unlikely) scenario that none of the given keys are found, the numeric user
  114. # ID is used.
  115. #
  116. # If the bridge is working properly, a phone number or an username should always be known, but
  117. # the other one can very well be empty.
  118. #
  119. # Valid keys:
  120. # "full name" (First and/or last name)
  121. # "full name reversed" (Last and/or first name)
  122. # "first name"
  123. # "last name"
  124. # "username"
  125. # "phone number"
  126. displayname_preference:
  127. - full name
  128. - username
  129. - phone number
  130. # Maximum length of displayname
  131. displayname_max_length: 100
  132. # Maximum number of members to sync per portal when starting up. Other members will be
  133. # synced when they send messages. The maximum is 10000, after which the Telegram server
  134. # will not send any more members.
  135. # Defaults to no local limit (-> limited to 10000 by server)
  136. max_initial_member_sync: -1
  137. # Whether or not to sync the member list in channels.
  138. # If no channel admins have logged into the bridge, the bridge won't be able to sync the member
  139. # list regardless of this setting.
  140. sync_channel_members: true
  141. # Whether or not to skip deleted members when syncing members.
  142. skip_deleted_members: true
  143. # Whether or not to automatically synchronize contacts and chats of Matrix users logged into
  144. # their Telegram account at startup.
  145. startup_sync: true
  146. # Number of most recently active dialogs to check when syncing chats.
  147. # Dialogs include groups and private chats, but only groups are synced.
  148. # Set to 0 to remove limit.
  149. sync_dialog_limit: 30
  150. # Whether or not to sync and create portals for direct chats at startup.
  151. sync_direct_chats: false
  152. # The maximum number of simultaneous Telegram deletions to handle.
  153. # A large number of simultaneous redactions could put strain on your homeserver.
  154. max_telegram_delete: 10
  155. # Whether or not to automatically sync the Matrix room state (mostly unpuppeted displaynames)
  156. # at startup and when creating a bridge.
  157. sync_matrix_state: true
  158. # Allow logging in within Matrix. If false, the only way to log in is using the out-of-Matrix
  159. # login website (see appservice.public config section)
  160. allow_matrix_login: true
  161. # Whether or not to bridge plaintext highlights.
  162. # Only enable this if your displayname_template has some static part that the bridge can use to
  163. # reliably identify what is a plaintext highlight.
  164. plaintext_highlights: false
  165. # Whether or not to make portals of publicly joinable channels/supergroups publicly joinable on Matrix.
  166. public_portals: true
  167. # Whether or not to use /sync to get presence, read receipts and typing notifications when using
  168. # your own Matrix account as the Matrix puppet for your Telegram account.
  169. sync_with_custom_puppets: true
  170. # Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
  171. #
  172. # If set, custom puppets will be enabled automatically for local users
  173. # instead of users having to find an access token and run `login-matrix`
  174. # manually.
  175. login_shared_secret: {{ matrix_mautrix_telegram_login_shared_secret|to_json }}
  176. # Set to false to disable link previews in messages sent to Telegram.
  177. telegram_link_preview: true
  178. # Use inline images instead of a separate message for the caption.
  179. # N.B. Inline images are not supported on all clients (e.g. Riot iOS).
  180. inline_images: false
  181. # Maximum size of image in megabytes before sending to Telegram as a document.
  182. image_as_file_size: 10
  183. # Maximum size of Telegram documents in megabytes to bridge.
  184. max_document_size: 100
  185. # Enable experimental parallel file transfer, which makes uploads/downloads much faster by
  186. # streaming from/to Matrix and using many connections for Telegram.
  187. # Note that generating HQ thumbnails for videos is not possible with streamed transfers.
  188. parallel_file_transfer: false
  189. # Whether or not created rooms should have federation enabled.
  190. # If false, created portal rooms will never be federated.
  191. federate_rooms: true
  192. # Settings for converting animated stickers.
  193. animated_sticker:
  194. # Format to which animated stickers should be converted.
  195. # disable - No conversion, send as-is (gzipped lottie)
  196. # png - converts to non-animated png (fastest),
  197. # gif - converts to animated gif, but loses transparency
  198. # webm - converts to webm video, requires ffmpeg executable with vp9 codec and webm container support
  199. target: gif
  200. # Arguments for converter. All converters take width and height.
  201. # GIF converter takes background as a hex color.
  202. args:
  203. width: 256
  204. height: 256
  205. background: "020202" # only for gif
  206. fps: 30 # only for webm
  207. # Overrides for base power levels.
  208. initial_power_level_overrides:
  209. user: {}
  210. group: {}
  211. # Whether to bridge Telegram bot messages as m.notices or m.texts.
  212. bot_messages_as_notices: true
  213. bridge_notices:
  214. # Whether or not Matrix bot messages (type m.notice) should be bridged.
  215. default: false
  216. # List of user IDs for whom the previous flag is flipped.
  217. # e.g. if bridge_notices.default is false, notices from other users will not be bridged, but
  218. # notices from users listed here will be bridged.
  219. exceptions: []
  220. # Some config options related to Telegram message deduplication.
  221. # The default values are usually fine, but some debug messages/warnings might recommend you
  222. # change these.
  223. deduplication:
  224. # Whether or not to check the database if the message about to be sent is a duplicate.
  225. pre_db_check: false
  226. # The number of latest events to keep when checking for duplicates.
  227. # You might need to increase this on high-traffic bridge instances.
  228. cache_queue_length: 20
  229. # The formats to use when sending messages to Telegram via the relay bot.
  230. #
  231. # Telegram doesn't have built-in emotes, so the m.emote format is also used for non-relaybot users.
  232. #
  233. # Available variables:
  234. # $sender_displayname - The display name of the sender (e.g. Example User)
  235. # $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
  236. # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
  237. # $message - The message content as HTML
  238. message_formats:
  239. m.text: "<b>$sender_displayname</b>: $message"
  240. m.notice: "<b>$sender_displayname</b>: $message"
  241. m.emote: "* <b>$sender_displayname</b> $message"
  242. m.file: "<b>$sender_displayname</b> sent a file: $message"
  243. m.image: "<b>$sender_displayname</b> sent an image: $message"
  244. m.audio: "<b>$sender_displayname</b> sent an audio file: $message"
  245. m.video: "<b>$sender_displayname</b> sent a video: $message"
  246. m.location: "<b>$sender_displayname</b> sent a location: $message"
  247. # Telegram doesn't have built-in emotes, this field specifies how m.emote's from authenticated
  248. # users are sent to telegram. All fields in message_formats are supported. Additionally, the
  249. # Telegram user info is available in the following variables:
  250. # $displayname - Telegram displayname
  251. # $username - Telegram username (may not exist)
  252. # $mention - Telegram @username or displayname mention (depending on which exists)
  253. emote_format: "* $mention $formatted_body"
  254. # The formats to use when sending state events to Telegram via the relay bot.
  255. #
  256. # Variables from `message_formats` that have the `sender_` prefix are available without the prefix.
  257. # In name_change events, `$prev_displayname` is the previous displayname.
  258. #
  259. # Set format to an empty string to disable the messages for that event.
  260. state_event_formats:
  261. join: "<b>$displayname</b> joined the room."
  262. leave: "<b>$displayname</b> left the room."
  263. name_change: "<b>$prev_displayname</b> changed their name to <b>$displayname</b>"
  264. # Filter rooms that can/can't be bridged. Can also be managed using the `filter` and
  265. # `filter-mode` management commands.
  266. #
  267. # Filters do not affect direct chats.
  268. # An empty blacklist will essentially disable the filter.
  269. filter:
  270. # Filter mode to use. Either "blacklist" or "whitelist".
  271. # If the mode is "blacklist", the listed chats will never be bridged.
  272. # If the mode is "whitelist", only the listed chats can be bridged.
  273. mode: blacklist
  274. # The list of group/channel IDs to filter.
  275. list: []
  276. # The prefix for commands. Only required in non-management rooms.
  277. command_prefix: "!tg"
  278. # Permissions for using the bridge.
  279. # Permitted values:
  280. # relaybot - Only use the bridge via the relaybot, no access to commands.
  281. # user - Relaybot level + access to commands to create bridges.
  282. # puppeting - User level + logging in with a Telegram account.
  283. # full - Full access to use the bridge, i.e. previous levels + Matrix login.
  284. # admin - Full access to use the bridge and some extra administration commands.
  285. # Permitted keys:
  286. # * - All Matrix users
  287. # domain - All users on that homeserver
  288. # mxid - Specific user
  289. permissions:
  290. '{{ matrix_mautrix_telegram_homeserver_domain }}': full
  291. # Options related to the message relay Telegram bot.
  292. relaybot:
  293. private_chat:
  294. # List of users to invite to the portal when someone starts a private chat with the bot.
  295. # If empty, private chats with the bot won't create a portal.
  296. invite: []
  297. # Whether or not to bridge state change messages in relaybot private chats.
  298. state_changes: true
  299. # When private_chat_invite is empty, this message is sent to users /starting the
  300. # relaybot. Telegram's "markdown" is supported.
  301. message: This is a Matrix bridge relaybot and does not support direct chats
  302. # List of users to invite to all group chat portals created by the bridge.
  303. group_chat_invite: []
  304. # Whether or not the relaybot should not bridge events in unbridged group chats.
  305. # If false, portals will be created when the relaybot receives messages, just like normal
  306. # users. This behavior is usually not desirable, as it interferes with manually bridging
  307. # the chat to another room.
  308. ignore_unbridged_group_chat: true
  309. # Whether or not to allow creating portals from Telegram.
  310. authless_portals: true
  311. # Whether or not to allow Telegram group admins to use the bot commands.
  312. whitelist_group_admins: true
  313. # Whether or not to ignore incoming events sent by the relay bot.
  314. ignore_own_incoming_events: true
  315. # List of usernames/user IDs who are also allowed to use the bot commands.
  316. whitelist: []
  317. # Telegram config
  318. telegram:
  319. # Get your own API keys at https://my.telegram.org/apps
  320. api_id: {{ matrix_mautrix_telegram_api_id }}
  321. api_hash: {{ matrix_mautrix_telegram_api_hash }}
  322. # (Optional) Create your own bot at https://t.me/BotFather
  323. bot_token: {{ matrix_mautrix_telegram_bot_token }}
  324. # Telethon connection options.
  325. connection:
  326. # The timeout in seconds to be used when connecting.
  327. timeout: 120
  328. # How many times the reconnection should retry, either on the initial connection or when
  329. # Telegram disconnects us. May be set to a negative or null value for infinite retries, but
  330. # this is not recommended, since the program can get stuck in an infinite loop.
  331. retries: 5
  332. # The delay in seconds to sleep between automatic reconnections.
  333. retry_delay: 1
  334. # The threshold below which the library should automatically sleep on flood wait errors
  335. # (inclusive). For instance, if a FloodWaitError for 17s occurs and flood_sleep_threshold
  336. # is 20s, the library will sleep automatically. If the error was for 21s, it would raise
  337. # the error instead. Values larger than a day (86400) will be changed to a day.
  338. flood_sleep_threshold: 60
  339. # How many times a request should be retried. Request are retried when Telegram is having
  340. # internal issues, when there is a FloodWaitError less than flood_sleep_threshold, or when
  341. # there's a migrate error. May take a negative or null value for infinite retries, but this
  342. # is not recommended, since some requests can always trigger a call fail (such as searching
  343. # for messages).
  344. request_retries: 5
  345. # Device info sent to Telegram.
  346. device_info:
  347. # "auto" = OS name+version.
  348. device_model: auto
  349. # "auto" = Telethon version.
  350. system_version: auto
  351. # "auto" = mautrix-telegram version.
  352. app_version: auto
  353. lang_code: en
  354. system_lang_code: en
  355. # Custom server to connect to.
  356. server:
  357. # Set to true to use these server settings. If false, will automatically
  358. # use production server assigned by Telegram. Set to false in production.
  359. enabled: false
  360. # The DC ID to connect to.
  361. dc: 2
  362. # The IP to connect to.
  363. ip: 149.154.167.40
  364. # The port to connect to. 443 may not work, 80 is better and both are equally secure.
  365. port: 80
  366. # Telethon proxy configuration.
  367. # You must install PySocks from pip for proxies to work.
  368. proxy:
  369. # Allowed types: disabled, socks4, socks5, http
  370. type: disabled
  371. # Proxy IP address and port.
  372. address: 127.0.0.1
  373. port: 1080
  374. # Whether or not to perform DNS resolving remotely.
  375. rdns: true
  376. # Proxy authentication (optional).
  377. username: ""
  378. password: ""
  379. # Python logging configuration.
  380. #
  381. # See section 16.7.2 of the Python documentation for more info:
  382. # https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
  383. logging:
  384. version: 1
  385. formatters:
  386. precise:
  387. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  388. handlers:
  389. console:
  390. class: logging.StreamHandler
  391. formatter: precise
  392. loggers:
  393. mau:
  394. level: DEBUG
  395. telethon:
  396. level: DEBUG
  397. aiohttp:
  398. level: INFO
  399. root:
  400. level: DEBUG
  401. handlers: [console]
  402. matrix_mautrix_telegram_configuration_extension_yaml: |
  403. # Your custom YAML configuration goes here.
  404. # This configuration extends the default starting configuration (`matrix_mautrix_telegram_configuration_yaml`).
  405. #
  406. # You can override individual variables from the default configuration, or introduce new ones.
  407. #
  408. # If you need something more special, you can take full control by
  409. # completely redefining `matrix_mautrix_telegram_configuration_yaml`.
  410. matrix_mautrix_telegram_configuration_extension: "{{ matrix_mautrix_telegram_configuration_extension_yaml|from_yaml if matrix_mautrix_telegram_configuration_extension_yaml|from_yaml is mapping else {} }}"
  411. # Holds the final configuration (a combination of the default and its extension).
  412. # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_telegram_configuration_yaml`.
  413. matrix_mautrix_telegram_configuration: "{{ matrix_mautrix_telegram_configuration_yaml|from_yaml|combine(matrix_mautrix_telegram_configuration_extension, recursive=True) }}"
  414. matrix_mautrix_telegram_registration_yaml: |
  415. id: telegram
  416. as_token: "{{ matrix_mautrix_telegram_appservice_token }}"
  417. hs_token: "{{ matrix_mautrix_telegram_homeserver_token }}"
  418. namespaces:
  419. users:
  420. - exclusive: true
  421. regex: '^@telegram_.+:{{ matrix_mautrix_telegram_homeserver_domain|regex_escape }}$'
  422. aliases:
  423. - exclusive: true
  424. regex: '^#telegram_.+:{{ matrix_mautrix_telegram_homeserver_domain|regex_escape }}$'
  425. url: {{ matrix_mautrix_telegram_appservice_address }}
  426. sender_localpart: telegrambot
  427. rate_limited: false
  428. matrix_mautrix_telegram_registration: "{{ matrix_mautrix_telegram_registration_yaml|from_yaml }}"