Filter responses and more filtering control #131
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This builds off PR #129 for language filtering, but revamps how languages are specified and overridden with a mechanism that we can use in the future for other room-specific settings, and that doesn't rely on room ids (but rather tokens).
Most notably, this PR (in addition to the language filtering added in #129) adds an ability to send responses to filtered messages either back to (just) the user who sent them (via a whisper), or to the whole room.
This allows configuration of the message (or multiple messages, for random selection), profile name, and uses a (simple) templating mechanism for the message so that you can (somewhat) personalize it for the user.
Other changes included here:
You can now control whether or not mods/admins are affected by filtering via a new
filter_mods
setting. (This is particularly useful for testing, but SOGS operators might also want to restrain their mods).profanity filtering can be room specific.
alphabet filtering can be room specific (revamping how PR Allow rejection of postings written in a particular alphabet. #129 did room-specific settings).
alphabet filtering can be configurably silent or not, like profanity filtering.
added a new, separate example .ini file showing how to set things up with room-specific settings.
Copying from the added
sogs.ini.filter-sample
file for the detail on how the room-specific settings and auto-reply get configured: