[RFE] Have a way to filter/ignore message from certain users
First of all, thank you very much for this bridge.
I'm trying to find a way to ignore messages from certain users. My use case is this: the Telegram group I'm bridging has the "Captcha bot" activated, and every time someone joins the group the messages sent by the bot get bridged to Matrix. I thought about simply kicking the bot from the Matrix room, but I'm not sure if that would mess something up. Instead, it would be nice to simply configure the bridge to ignore everything the captcha bot says.
I could not find anything in the docs, so I decided to open this feature request. Thanks in advance!
I have a different usage but need the same feature:
My group maintains a 4-way bridge: IRC – Matrix – Telegram – XMPP. In order to prevent looping, I need to make sure each bridge ignores any messages sent from another bridge.
We are sure looping won’t happen at Telegram side, since Telegram hides bot messages from other bots, but it can still happen at Matrix or IRC sides. It would be a wonderful enhancement if Mautrix-Telegram can ignore Matrix usernames according to a pattern.
It looks like the most quick-and-dirty method is to patch portal.Portal._handle_matrix_message or (to filter Matrix side) and portal.Portal._handle_telegram_message (to filter Telegram side).
The mautrix-python library also has a place to patch Matrix-side filters: mautrix.bridge.matrix.BaseMatrixHandler.allow_matrix_event
But if we want to make the filters configurable, I believe the author is more familiar with the configuration system.