Censor
Plugin name: censor
The censor plugin provides administrators and moderators a simple way to filter certain types of malicious and offensive content, such as:
- Invite Links
- URLs
- Inappropriate or offensive words (attachment names included)
This plugin combined with the spam plugin can result in a very robust automatic abuse-prevention system.
This plugin should be enabled in conjunction with the infractions plugin for punishment implementation.
Commands
Name | Description | Default Level | Usage |
---|---|---|---|
!antiraid OR !raid | Show if antiraid measures are active. | Moderator | !antiraid |
!antiraid disable OR !raid disable | Disable antiraid and remove the raidrole from all members. | Moderator | !raid disable |
Configuration Options
Option | Description | Type | Default |
---|---|---|---|
levels | A mapping of levels to censor configurations. This will match any user with a level that is equal or lower. | dict | empty |
channels | A mapping of channels to censor configurations. | dict | empty |
Censor Configuration
Option | Description | Type | Default |
---|---|---|---|
filter_zalgo | Whether to filter zalgo text from messages. | bool | true |
zalgo_channel_whitelist | Array of channels to whitelist for zalgo messages | list(snowflake) | empty |
filter_invites | Whether to filter invite links or vanities from messages. | bool | true |
invites_guild_whitelist | A list of whitelisted guild IDs for invite codes or vanities. | list(snowflake) | empty |
invites_whitelist | A list of whitelisted invite codes or vanities. | list(str) | empty |
invites_blacklist | A list of blacklisted invite codes or vanities. | list(str) | empty |
invites_channel_whitelist | Array of channels to whitelist for invites. | list(snowflake) | empty |
filter_domains | Whether to filter URLs in messages based on domain. (e.g. imgur.com ) | bool | true |
domains_whitelist | A whitelist of domain names. | list(str) | empty |
domains_blacklist | A blacklist of domain names. | list(str) | empty |
domains_channel_whitelist | Array of channels to whitelist for domains. | list(snowflake) | empty |
blocked_words | A list of words (must be separated by a boundary) that are blacklisted. Also includes attachment names. | list(str) | empty |
blocked_tokens | A list of tokens (can appear in the middle of words) that are blacklisted. Also includes attachment names. | list(str) | empty |
words_channel_whitelist | Array of channels to whitelist for blocked words and tokens. | list(snowflake) | empty |
blocked_mentions | A list of blacklisted mentions. See "Blocked Mention Tokens" for setup details. | list(str) | empty |
mention_channel_whitelist | Array of channels to whitelist for blocked mentions. | list(snowflake) | empty |
filter_all_caps | Whether to filter messages that contain a certain number of consecutive all capital letters. Spaces in messages are ignored when counting. | bool | false |
all_caps_min_char_length | Minimum length of consecutive all capital letters to censor. | int | 5 |
all_caps_min_message_count | Minimum number of violating messages in all_caps_interval trigger the censor. | int | 3 |
all_caps_interval | Seconds in which over all_caps_min_message_count of messages will trigger the censor. | int | 30 |
all_caps_channel_whitelist | Array of channels to whitelist for all caps filter. | list(snowflake) | empty |
blocked_nicknames | A list of names (can appear in the middle of nicknames) that are blacklisted | list(str) | empty |
block_zalgo_nicknames | Whether to filter nicknames with zalgo text | bool | false |
hoist_blacklist | A list of banned nickname prefixes. | list(str) | empty |
message_char_limit | Maximum allowed message length. If set to 0 , no limit is set. | int | 0 |
char_limit_channel_whitelist | Array of channels to whitelist for message character limit. | list(snowflake) | empty |
warn_on_censor | Whether to automatically warn a user when their name or message is censored. | bool | false |
mute_violations | Enable ability to mute a user after a set number of violations. | bool | false |
mute_violations_count | Number of violations that can be accrued in mute_violations_interval before muting. | int | 3 |
mute_violations_interval | Seconds within which a user with over mute_violations_count violations will trigger a mute. | int | 10 |
mute_violations_duration | Seconds to mute a user with sufficient violations. | int | 300 |
antiraid | A single antiraid configuration. | dict | None |
When available, only whitelists or only blacklists will be checked. Whitelists will be checked first if both are configured.
Bad nicknames will be reverted to the last appropriate version or assigned a random censored name {int}
nickname.
A user will accrue one violation for each message and nickname that triggers a censor deletion or edit.
Blocked Mention Tokens
Token | Description | Example |
---|---|---|
{r<snowflake>} | Will censor mentions of the specified role. | {r579304983896391680} |
{c<snowflake>} | Will censor mentions of the specified channel. | {c572876188918349857} |
{u<snowflake>} | Will censor mentions of the specified user. | {u84912325282254848} |
Antiraid Configuration
Option | Description | Type | Default |
---|---|---|---|
count | Number of members that must join guild within interval to trigger antiraid. | int | 5 |
interval | Seconds within which the count of members trigger the antiraid. | int | 60 |
key_duration | Seconds a user is remembered after joining. This should be larger than interval . | int | 600 |
lockdown_duration | Seconds that guild should be locked down with antiraid measures. | int | 600 |
raidrole | Role ID applied to all users during antiraid measures. | snowflake | empty |
notifyrole | Role ID that should be notified when antiraid is automatically triggered | snowflake | empty |
raid_action | Action type to take on users when antiraid is triggered. Valid actions: ROLE , KICK , TEMPBAN , BAN | str | ROLE |
raid_action_duration | Duration of raid_action TEMPBAN punishment. Durations can be integers which are parsed by seconds or duration strings. e.g. '10s', '5m', '2h5m' | str | 300s |
raid_action_notify | Whether or not to send a DM to users with antiraid measures applied. | bool | False |
raid_action_reason | Reason sent by DM to users with antiraid measures applied. Notification formatting is taken from the notify config in the infractions plugin if set. | str | ANTIRAID |
How Antiraid works
- Antiraid measures are enabled once more then
count
number of joins are detected withininterval
seconds. Thelockdown_duration
begins. - All users in the join table for the
key_duration
will have theraid_action
retroactively applied. - All users that join during
lockdown_duration
will have theraid_action
applied. - Antiraid measures will stop once the
lockdown_duration
expires. - If Antiraid is setup to give out a role, moderators will need to manually run
!raid disable
to remove all raid roles from remaining users.
The modlog plugin will need to be configured with RAID
logs for proper notifyrole
alerts.
Please be mindful what level the antiraid configuration is added under, especially if you auto assign join roles in the admin plugin.
Configuration Example
plugins:
censor:
levels:
50:
filter_zalgo: true
filter_invites: true
invites_guild_whitelist:
- 205769246008016897 # Guild 1
- 272885620769161216 # Guild 2
invites_whitelist:
- discord-developers
- discord-testers
- discord-api
- events
- discord-linux
- gamenight
- discord-feedback
filter_domains: true
domains_blacklist:
- website.com
- weirdlink.net
blocked_tokens:
- token1
- token2
blocked_words:
- word1
- word2
- word3
blocked_mentions:
- u84912325282254848
- r579304983896391680
- c572876188918349857
blocked_nicknames: [blurb]
hoist_blacklist:
- '!'
- '?'
zalgo_channel_whitelist: [510413274060161024]
invites_channel_whitelist: [510413274060161024]
domains_channel_whitelist: [510413274060161024]
words_channel_whitelist: [510413274060161024]
char_limit_channel_whitelist: [510413274060161024]
mention_channel_whitelist: [510413274060161024]
mute_violations: true
mute_violations_count: 5
mute_violations_interval: 15
mute_violations_duration: 600
antiraid:
key_duration: 300
interval: 30
count: 3
lockdown_duration: 300
raidrole: 538720817773805569
notifyrole: 536728730714898442
channels:
290923757399310337:
blocked_words: [word4]
infractions:
mute_role: 579398816072073246