mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-10-24 06:42:22 +00:00
Enhance profanity filtering to include hate symbol detection and censorship
- Updated the profanity filter to check for hate symbols (e.g., swastika Unicode) in addition to word-based profanity, ensuring comprehensive message filtering. - Modified the `censor` function to replace hate symbols with `***`, maintaining functionality even when the `better-profanity` package is unavailable. - Updated documentation in `discord-bridge.md` and `telegram-bridge.md` to reflect the new hate symbol handling features. - Added tests to verify detection and censorship of hate symbols, ensuring robustness of the profanity filter.
This commit is contained in:
1 parent
3c56cbb69d
commit
e348fd8d53
4 files changed
+57
-4
No files matched your search
@@ -86,7 +86,8 @@ Preview: `https://api.dicebear.com/7.x/{style}/png?seed=YourName`
|
||||
- **drop** (default): Do not bridge messages that contain profanity (message is dropped).
|
||||
- **censor**: Replace profanity with `****` and bridge the message.
|
||||
- **off**: No filtering; bridge all messages as-is.
|
||||
- Requires the `better-profanity` package (see `requirements.txt`). If the package is not installed and `filter_profanity` is `drop` or `censor`, a warning is logged and messages are bridged without filtering.
|
||||
- The filter checks word-based profanity (via `better-profanity` and optional `unidecode` for homoglyphs) and blocked hate symbols (e.g. swastika Unicode 卐/卍). Symbols are replaced with `***`.
|
||||
- Requires the `better-profanity` package (see `requirements.txt`). If the package is not installed and `filter_profanity` is `drop` or `censor`, a warning is logged and messages are bridged without word filtering; hate symbols are still filtered even without the package.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ Send a message on the bridged MeshCore channel — it should appear in the Teleg
|
||||
| `parse_mode` | No | `HTML` (default), `Markdown`, or `MarkdownV2` |
|
||||
| `disable_web_page_preview` | No | `true`/`false` — disable link previews (default: false) |
|
||||
| `max_message_length` | No | 1–4096; truncate longer messages (default: 4096) |
|
||||
| `filter_profanity` | No | Profanity handling: `drop` (default, do not bridge), `censor` (replace with ****), or `off`. Requires `better-profanity` package. |
|
||||
| `filter_profanity` | No | Profanity handling: `drop` (default), `censor`, or `off`. Word list via `better-profanity`; hate symbols (e.g. 卐/卍) are always blocked/censored. |
|
||||
|
||||
\* Either `api_token` in config or `TELEGRAM_BOT_TOKEN` in the environment must be set when the bridge is enabled.
|
||||
|
||||
|
||||
Reference in new issue
Block a user