Message Filter
Configuring the Filter Module
The Filter module allows users to add, list, and remove message filters for channels, servers, or the entire bot. Filters can be used to automatically modify or block messages based on specified patterns.
Configuration Options
-
Add a Filter
- Adds a new filter to the target (channel, server, or bot).
- Usage:
,filter add <m/pattern/> | <s/pattern/replace/>
- Examples:
,filter add m/badword/
,filter add s/oldword/newword/
-
List Filters
- Lists all filters or a specific filter at the given index.
- Usage:
,filter list [index]
- Examples:
,filter list
,filter list 2
-
Remove a Filter
- Removes a filter at the given index.
- Usage:
,filter remove <index>
- Example:
,filter remove 1
Details
- Filter Types:
- Match (m): Filters messages that match a specific pattern.
- Substitute (s): Substitutes a pattern in the message with a replacement string.
- Examples:
- Add a Match Filter:
,filter add m/badword/
- This will drop any message containing “badword”.
- Add a Substitute Filter:
,filter add s/oldword/newword/
- This will replace “oldword” with “newword” in messages.
- Add a Match Filter:
- Notes:
- Filters are applied to messages before they are sent.
- Filters can be configured for specific channels, servers, or the entire bot.
- Use the list command to see all active filters and their indices.
- Ensure you have the appropriate permissions to add or remove filters.
Examples
- To add a match filter that drops messages containing “spam”:
,filter add m/spam/
- To add a substitute filter that replaces “foo” with “bar”:
,filter add s/foo/bar/
- To list all filters:
,filter list
- To remove the first filter:
,filter remove 0
Permissions
- Channel Filters: Use the cfilter command with high,filter access and o mode in the channel.
- Bot Filters: Use the bfilter command with cfilter permission.
- Server Filters: Use the filter command with cfilter permission.