example-config.yaml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. # Homeserver details.
  2. homeserver:
  3. # The address that this appservice can use to connect to the homeserver.
  4. address: https://matrix.example.com
  5. # Publicly accessible base URL for media, used for avatars in relay mode.
  6. # If not set, the connection address above will be used.
  7. public_address: null
  8. # The domain of the homeserver (also known as server_name, used for MXIDs, etc).
  9. domain: example.com
  10. # What software is the homeserver running?
  11. # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here.
  12. software: standard
  13. # The URL to push real-time bridge status to.
  14. # If set, the bridge will make POST requests to this URL whenever a user's discord connection state changes.
  15. # The bridge will use the appservice as_token to authorize requests.
  16. status_endpoint: null
  17. # Endpoint for reporting per-message status.
  18. message_send_checkpoint_endpoint: null
  19. # Does the homeserver support https://github.com/matrix-org/matrix-spec-proposals/pull/2246?
  20. async_media: false
  21. # Should the bridge use a websocket for connecting to the homeserver?
  22. # The server side is currently not documented anywhere and is only implemented by mautrix-wsproxy,
  23. # mautrix-asmux (deprecated), and hungryserv (proprietary).
  24. websocket: false
  25. # How often should the websocket be pinged? Pinging will be disabled if this is zero.
  26. ping_interval_seconds: 0
  27. # Application service host/registration related details.
  28. # Changing these values requires regeneration of the registration.
  29. appservice:
  30. # The address that the homeserver can use to connect to this appservice.
  31. address: http://localhost:29334
  32. # The hostname and port where this appservice should listen.
  33. hostname: 0.0.0.0
  34. port: 29334
  35. # Database config.
  36. database:
  37. # The database type. "sqlite3-fk-wal" and "postgres" are supported.
  38. type: postgres
  39. # The database URI.
  40. # SQLite: A raw file path is supported, but `file:<path>?_txlock=immediate` is recommended.
  41. # https://github.com/mattn/go-sqlite3#connection-string
  42. # Postgres: Connection string. For example, postgres://user:password@host/database?sslmode=disable
  43. # To connect via Unix socket, use something like postgres:///dbname?host=/var/run/postgresql
  44. uri: postgres://user:password@host/database?sslmode=disable
  45. # Maximum number of connections. Mostly relevant for Postgres.
  46. max_open_conns: 20
  47. max_idle_conns: 2
  48. # Maximum connection idle time and lifetime before they're closed. Disabled if null.
  49. # Parsed with https://pkg.go.dev/time#ParseDuration
  50. max_conn_idle_time: null
  51. max_conn_lifetime: null
  52. # The unique ID of this appservice.
  53. id: discord
  54. # Appservice bot details.
  55. bot:
  56. # Username of the appservice bot.
  57. username: discordbot
  58. # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
  59. # to leave display name/avatar as-is.
  60. displayname: Discord bridge bot
  61. avatar: mxc://maunium.net/nIdEykemnwdisvHbpxflpDlC
  62. # Whether or not to receive ephemeral events via appservice transactions.
  63. # Requires MSC2409 support (i.e. Synapse 1.22+).
  64. ephemeral_events: true
  65. # Should incoming events be handled asynchronously?
  66. # This may be necessary for large public instances with lots of messages going through.
  67. # However, messages will not be guaranteed to be bridged in the same order they were sent in.
  68. async_transactions: false
  69. # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
  70. as_token: "This value is generated when generating the registration"
  71. hs_token: "This value is generated when generating the registration"
  72. # Bridge config
  73. bridge:
  74. # Localpart template of MXIDs for Discord users.
  75. # {{.}} is replaced with the internal ID of the Discord user.
  76. username_template: discord_{{.}}
  77. # Displayname template for Discord users. This is also used as the room name in DMs if private_chat_portal_meta is enabled.
  78. # Available variables:
  79. # .ID - Internal user ID
  80. # .Username - Legacy display/username on Discord
  81. # .GlobalName - New displayname on Discord
  82. # .Discriminator - The 4 numbers after the name on Discord
  83. # .Bot - Whether the user is a bot
  84. # .System - Whether the user is an official system user
  85. # .Webhook - Whether the user is a webhook
  86. displayname_template: '{{or .GlobalName .Username}}{{if .Bot}} (bot){{end}}'
  87. # Displayname template for Discord channels (bridged as rooms, or spaces when type=4).
  88. # Available variables:
  89. # .Name - Channel name, or user displayname (pre-formatted with displayname_template) in DMs.
  90. # .ParentName - Parent channel name (used for categories).
  91. # .GuildName - Guild name.
  92. # .NSFW - Whether the channel is marked as NSFW.
  93. # .Type - Channel type (see values at https://github.com/bwmarrin/discordgo/blob/v0.25.0/structs.go#L251-L267)
  94. channel_name_template: '{{if or (eq .Type 3) (eq .Type 4)}}{{.Name}}{{else}}#{{.Name}}{{end}}'
  95. # Displayname template for Discord guilds (bridged as spaces).
  96. # Available variables:
  97. # .Name - Guild name
  98. guild_name_template: '{{.Name}}'
  99. # Whether to explicitly set the avatar and room name for private chat portal rooms.
  100. # If set to `default`, this will be enabled in encrypted rooms and disabled in unencrypted rooms.
  101. # If set to `always`, all DM rooms will have explicit names and avatars set.
  102. # If set to `never`, DM rooms will never have names and avatars set.
  103. private_chat_portal_meta: default
  104. portal_message_buffer: 128
  105. # Number of private channel portals to create on bridge startup.
  106. # Other portals will be created when receiving messages.
  107. startup_private_channel_create_limit: 5
  108. # Should the bridge send a read receipt from the bridge bot when a message has been sent to Discord?
  109. delivery_receipts: false
  110. # Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
  111. message_status_events: false
  112. # Whether the bridge should send error notices via m.notice events when a message fails to bridge.
  113. message_error_notices: true
  114. # Should the bridge use space-restricted join rules instead of invite-only for guild rooms?
  115. # This can avoid unnecessary invite events in guild rooms when members are synced in.
  116. restricted_rooms: true
  117. # Should the bridge automatically join the user to threads on Discord when the thread is opened on Matrix?
  118. # This only works with clients that support thread read receipts (MSC3771 added in Matrix v1.4).
  119. autojoin_thread_on_open: true
  120. # Should inline fields in Discord embeds be bridged as HTML tables to Matrix?
  121. # Tables aren't supported in all clients, but are the only way to emulate the Discord inline field UI.
  122. embed_fields_as_tables: true
  123. # Should guild channels be muted when the portal is created? This only meant for single-user instances,
  124. # it won't mute it for all users if there are multiple Matrix users in the same Discord guild.
  125. mute_channels_on_create: false
  126. # Should the bridge update the m.direct account data event when double puppeting is enabled.
  127. # Note that updating the m.direct event is not atomic (except with mautrix-asmux)
  128. # and is therefore prone to race conditions.
  129. sync_direct_chat_list: false
  130. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
  131. # This field will automatically be changed back to false after it, except if the config file is not writable.
  132. resend_bridge_info: false
  133. # Should incoming custom emoji reactions be bridged as mxc:// URIs?
  134. # If set to false, custom emoji reactions will be bridged as the shortcode instead, and the image won't be available.
  135. custom_emoji_reactions: true
  136. # Should the bridge attempt to completely delete portal rooms when a channel is deleted on Discord?
  137. # If true, the bridge will try to kick Matrix users from the room. Otherwise, the bridge only makes ghosts leave.
  138. delete_portal_on_channel_delete: false
  139. # Should the bridge delete all portal rooms when you leave a guild on Discord?
  140. # This only applies if the guild has no other Matrix users on this bridge instance.
  141. delete_guild_on_leave: true
  142. # Whether or not created rooms should have federation enabled.
  143. # If false, created portal rooms will never be federated.
  144. federate_rooms: true
  145. # Prefix messages from webhooks with the profile info? This can be used along with a custom displayname_template
  146. # to better handle webhooks that change their name all the time (like ones used by bridges).
  147. prefix_webhook_messages: false
  148. # Bridge webhook avatars?
  149. enable_webhook_avatars: true
  150. # Should the bridge upload media to the Discord CDN directly before sending the message when using a user token,
  151. # like the official client does? The other option is sending the media in the message send request as a form part
  152. # (which is always used by bots and webhooks).
  153. use_discord_cdn_upload: true
  154. # Should mxc uris copied from Discord be cached?
  155. # This can be `never` to never cache, `unencrypted` to only cache unencrypted mxc uris, or `always` to cache everything.
  156. # If you have a media repo that generates non-unique mxc uris, you should set this to never.
  157. cache_media: unencrypted
  158. # Patterns for converting Discord media to custom mxc:// URIs instead of reuploading.
  159. # Each of the patterns can be set to null to disable custom URIs for that type of media.
  160. # More details can be found at https://docs.mau.fi/bridges/go/discord/direct-media.html
  161. media_patterns:
  162. # Should custom mxc:// URIs be used instead of reuploading media?
  163. enabled: false
  164. # Pattern for normal message attachments.
  165. attachments: mxc://discord-media.mau.dev/attachments|{{.ChannelID}}|{{.AttachmentID}}|{{.FileName}}
  166. # Pattern for custom emojis.
  167. emojis: mxc://discord-media.mau.dev/emojis|{{.ID}}.{{.Ext}}
  168. # Pattern for stickers. Note that animated lottie stickers will not be converted if this is enabled.
  169. stickers: mxc://discord-media.mau.dev/stickers|{{.ID}}.{{.Ext}}
  170. # Pattern for static user avatars.
  171. avatars: mxc://discord-media.mau.dev/avatars|{{.UserID}}|{{.AvatarID}}.{{.Ext}}
  172. # Settings for converting animated stickers.
  173. animated_sticker:
  174. # Format to which animated stickers should be converted.
  175. # disable - No conversion, send as-is (lottie JSON)
  176. # png - converts to non-animated png (fastest)
  177. # gif - converts to animated gif
  178. # webm - converts to webm video, requires ffmpeg executable with vp9 codec and webm container support
  179. # webp - converts to animated webp, requires ffmpeg executable with webp codec/container support
  180. target: webp
  181. # Arguments for converter. All converters take width and height.
  182. args:
  183. width: 320
  184. height: 320
  185. fps: 25 # only for webm, webp and gif (2, 5, 10, 20 or 25 recommended)
  186. # Servers to always allow double puppeting from
  187. double_puppet_server_map:
  188. example.com: https://example.com
  189. # Allow using double puppeting from any server with a valid client .well-known file.
  190. double_puppet_allow_discovery: false
  191. # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
  192. #
  193. # If set, double puppeting will be enabled automatically for local users
  194. # instead of users having to find an access token and run `login-matrix`
  195. # manually.
  196. login_shared_secret_map:
  197. example.com: foobar
  198. # The prefix for commands. Only required in non-management rooms.
  199. command_prefix: '!discord'
  200. # Messages sent upon joining a management room.
  201. # Markdown is supported. The defaults are listed below.
  202. management_room_text:
  203. # Sent when joining a room.
  204. welcome: "Hello, I'm a Discord bridge bot."
  205. # Sent when joining a management room and the user is already logged in.
  206. welcome_connected: "Use `help` for help."
  207. # Sent when joining a management room and the user is not logged in.
  208. welcome_unconnected: "Use `help` for help or `login` to log in."
  209. # Optional extra text sent when joining a management room.
  210. additional_help: ""
  211. # Settings for backfilling messages.
  212. backfill:
  213. # Limits for forward backfilling.
  214. forward_limits:
  215. # Initial backfill (when creating portal). 0 means backfill is disabled.
  216. # A special unlimited value is not supported, you must set a limit. Initial backfill will
  217. # fetch all messages first before backfilling anything, so high limits can take a lot of time.
  218. initial:
  219. dm: 0
  220. channel: 0
  221. thread: 0
  222. # Missed message backfill (on startup).
  223. # 0 means backfill is disabled, -1 means fetch all messages since last bridged message.
  224. # When using unlimited backfill (-1), messages are backfilled as they are fetched.
  225. # With limits, all messages up to the limit are fetched first and backfilled afterwards.
  226. missed:
  227. dm: 0
  228. channel: 0
  229. thread: 0
  230. # Maximum members in a guild to enable backfilling. Set to -1 to disable limit.
  231. # This can be used as a rough heuristic to disable backfilling in channels that are too active.
  232. # Currently only applies to missed message backfill.
  233. max_guild_members: -1
  234. # End-to-bridge encryption support options.
  235. #
  236. # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
  237. encryption:
  238. # Allow encryption, work in group chat rooms with e2ee enabled
  239. allow: false
  240. # Default to encryption, force-enable encryption in all portals the bridge creates
  241. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  242. default: false
  243. # Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data.
  244. appservice: false
  245. # Require encryption, drop any unencrypted messages.
  246. require: false
  247. # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
  248. # You must use a client that supports requesting keys from other users to use this feature.
  249. allow_key_sharing: false
  250. # Should users mentions be in the event wire content to enable the server to send push notifications?
  251. plaintext_mentions: false
  252. # Options for deleting megolm sessions from the bridge.
  253. delete_keys:
  254. # Beeper-specific: delete outbound sessions when hungryserv confirms
  255. # that the user has uploaded the key to key backup.
  256. delete_outbound_on_ack: false
  257. # Don't store outbound sessions in the inbound table.
  258. dont_store_outbound: false
  259. # Ratchet megolm sessions forward after decrypting messages.
  260. ratchet_on_decrypt: false
  261. # Delete fully used keys (index >= max_messages) after decrypting messages.
  262. delete_fully_used_on_decrypt: false
  263. # Delete previous megolm sessions from same device when receiving a new one.
  264. delete_prev_on_new_session: false
  265. # Delete megolm sessions received from a device when the device is deleted.
  266. delete_on_device_delete: false
  267. # Periodically delete megolm sessions when 2x max_age has passed since receiving the session.
  268. periodically_delete_expired: false
  269. # What level of device verification should be required from users?
  270. #
  271. # Valid levels:
  272. # unverified - Send keys to all device in the room.
  273. # cross-signed-untrusted - Require valid cross-signing, but trust all cross-signing keys.
  274. # cross-signed-tofu - Require valid cross-signing, trust cross-signing keys on first use (and reject changes).
  275. # cross-signed-verified - Require valid cross-signing, plus a valid user signature from the bridge bot.
  276. # Note that creating user signatures from the bridge bot is not currently possible.
  277. # verified - Require manual per-device verification
  278. # (currently only possible by modifying the `trust` column in the `crypto_device` database table).
  279. verification_levels:
  280. # Minimum level for which the bridge should send keys to when bridging messages from WhatsApp to Matrix.
  281. receive: unverified
  282. # Minimum level that the bridge should accept for incoming Matrix messages.
  283. send: unverified
  284. # Minimum level that the bridge should require for accepting key requests.
  285. share: cross-signed-tofu
  286. # Options for Megolm room key rotation. These options allow you to
  287. # configure the m.room.encryption event content. See:
  288. # https://spec.matrix.org/v1.3/client-server-api/#mroomencryption for
  289. # more information about that event.
  290. rotation:
  291. # Enable custom Megolm room key rotation settings. Note that these
  292. # settings will only apply to rooms created after this option is
  293. # set.
  294. enable_custom: false
  295. # The maximum number of milliseconds a session should be used
  296. # before changing it. The Matrix spec recommends 604800000 (a week)
  297. # as the default.
  298. milliseconds: 604800000
  299. # The maximum number of messages that should be sent with a given a
  300. # session before changing it. The Matrix spec recommends 100 as the
  301. # default.
  302. messages: 100
  303. # Disable rotating keys when a user's devices change?
  304. # You should not enable this option unless you understand all the implications.
  305. disable_device_change_key_rotation: false
  306. # Settings for provisioning API
  307. provisioning:
  308. # Prefix for the provisioning API paths.
  309. prefix: /_matrix/provision
  310. # Shared secret for authentication. If set to "generate", a random secret will be generated,
  311. # or if set to "disable", the provisioning API will be disabled.
  312. shared_secret: generate
  313. # Permissions for using the bridge.
  314. # Permitted values:
  315. # relay - Talk through the relaybot (if enabled), no access otherwise
  316. # user - Access to use the bridge to chat with a Discord account.
  317. # admin - User level and some additional administration tools
  318. # Permitted keys:
  319. # * - All Matrix users
  320. # domain - All users on that homeserver
  321. # mxid - Specific user
  322. permissions:
  323. "*": relay
  324. "example.com": user
  325. "@admin:example.com": admin
  326. # Logging config. See https://github.com/tulir/zeroconfig for details.
  327. logging:
  328. min_level: debug
  329. writers:
  330. - type: stdout
  331. format: pretty-colored
  332. - type: file
  333. format: json
  334. filename: ./logs/mautrix-discord.log
  335. max_size: 100
  336. max_backups: 10
  337. compress: true