You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every server would be able to define a list of find-and-replace regular expressions. These would be applied to incoming messages before sending them out to all other clients.
For example, let's say "apple" is a very very naughty word. Then, into the decent command line, you could type
decent> add filter /apple/i redacted
The first argument is a regular expression, and the second argument is what the replacement should be. Referencing matched groups can be done through $number. For example, if a server for developing Decent wanted to replace numeric issue numbers with links to their GitHub issue and PRs, they could do
(Note: /issues/ will redirect to /pulls/ automatically if needed).
This is useful because it edits messages in a different way to how a bot would. Main advantages are
Still works when bot is offline
Bot feels wrong because the content of the message isn't changing and it's spamming the server with unneeded edits for every single message
Easy to set up
For more complicated actions, you can of course use a bot.
How should we deal with removing these filters? I propose
decent> ls filter
There are currently 2 filters in place for this server:
+------+-------------+---------------------------------------------------------+
| ID | Matches | Replaced by |
+------+-----------------------+-----------------------------------------------+
| 1 | /#[0-9]+/ | [#$1](https://github.com/decent-chat/decent/issues/$1/) |
+------+-----------------------+-----------------------------------------------+
| 2 | /apple/i | REDACTED |
+------+------------------+----------------------------------------------------+
decent> delete filter 1
The filter with ID 1 had been removed. It was
/#[0-9]+/ ----> [#$1](https://github.com/decent-chat/decent/issues/$1/)
(aah took me way too long to construct that table in a proportional font)
Or, this could be done on the actual (web)client because it's not too hard to do that and it's not that advanced of a feature.
The text was updated successfully, but these errors were encountered:
Okay, for those wanting to implement the actual filtering bit, I guess this is relevant bit which decides what to do with incoming messages. I suppose the filtering should happen before it even enters the database?
This is separate to how we receive the filter rules though.
bates64
changed the title
Let servers modify messages according to server-defined Regular Expressions
Let servers modify messages according to admin-defined Regular Expressions
Mar 4, 2018
This issue is a feature request.
Every server would be able to define a list of find-and-replace regular expressions. These would be applied to incoming messages before sending them out to all other clients.
For example, let's say "apple" is a very very naughty word. Then, into the decent command line, you could type
The first argument is a regular expression, and the second argument is what the replacement should be. Referencing matched groups can be done through
$number
. For example, if a server for developing Decent wanted to replace numeric issue numbers with links to their GitHub issue and PRs, they could do(Note:
/issues/
will redirect to/pulls/
automatically if needed).This is useful because it edits messages in a different way to how a bot would. Main advantages are
For more complicated actions, you can of course use a bot.
How should we deal with removing these filters? I propose
(aah took me way too long to construct that table in a proportional font)
Or, this could be done on the actual (web)client because it's not too hard to do that and it's not that advanced of a feature.
The text was updated successfully, but these errors were encountered: