Skip to content
This repository has been archived by the owner on Mar 2, 2024. It is now read-only.

Add config parameter to disable bridging m.notice-type messages #280

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mautrix_facebook/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def do_update(self, helper: ConfigUpdateHelper) -> None:
copy("bridge.max_startup_thread_sync_count")
copy("bridge.temporary_disconnect_notices")
copy("bridge.disable_bridge_notices")
copy("bridge.bridge_matrix_notices")
if "bridge.refresh_on_reconnection_fail" in self:
base["bridge.on_reconnection_fail.action"] = (
"refresh" if self["bridge.refresh_on_reconnection_fail"] else None
Expand Down
2 changes: 2 additions & 0 deletions mautrix_facebook/example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ bridge:
temporary_disconnect_notices: false
# Disable bridge notices entirely
disable_bridge_notices: false
# Should Matrix m.notice-type messages be bridged to Facebook?
bridge_matrix_notices: true
on_reconnection_fail:
# What to do if a reconnection attempt fails? Options: reconnect, refresh, null
action: reconnect
Expand Down
6 changes: 6 additions & 0 deletions mautrix_facebook/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,8 +1274,14 @@ async def _make_dbm(self, sender: u.User, event_id: EventID) -> DBMessage:
async def _handle_matrix_text(
self, event_id: EventID, sender: u.User, message: TextMessageEventContent
) -> None:
if (
message.msgtype == MessageType.NOTICE
and not self.config["bridge.bridge_matrix_notices"]
):
return
converted = await matrix_to_facebook(message, self.mxid, self.log)
dbm = await self._make_dbm(sender, event_id)

resp = await sender.mqtt.send_message(
self.fbid,
self.fb_type != ThreadType.USER,
Expand Down