Skip to main content

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)
tip

This plugin combined with the spam plugin can result in a very robust automatic abuse-prevention system.

caution

This plugin should be enabled in conjunction with the infractions plugin for punishment implementation.

Commands

NameDescriptionDefault LevelUsage
!antiraid OR !raidShow if antiraid measures are active.Moderator!antiraid
!antiraid disable OR !raid disableDisable antiraid and remove the raidrole from all members.Moderator!raid disable

Configuration Options

OptionDescriptionTypeDefault
levelsA mapping of levels to censor configurations. This will match any user with a level that is equal or lower.dictempty
channelsA mapping of channels to censor configurations.dictempty

Censor Configuration

OptionDescriptionTypeDefault
filter_zalgoWhether to filter zalgo text from messages.booltrue
zalgo_channel_whitelistArray of channels to whitelist for zalgo messageslist(snowflake)empty
filter_invitesWhether to filter invite links or vanities from messages.booltrue
invites_guild_whitelistA list of whitelisted guild IDs for invite codes or vanities.list(snowflake)empty
invites_whitelistA list of whitelisted invite codes or vanities.list(str)empty
invites_blacklistA list of blacklisted invite codes or vanities.list(str)empty
invites_channel_whitelistArray of channels to whitelist for invites.list(snowflake)empty
filter_domainsWhether to filter URLs in messages based on domain. (e.g. imgur.com)booltrue
domains_whitelistA whitelist of domain names.list(str)empty
domains_blacklistA blacklist of domain names.list(str)empty
domains_channel_whitelistArray of channels to whitelist for domains.list(snowflake)empty
blocked_wordsA list of words (must be separated by a boundary) that are blacklisted. Also includes attachment names.list(str)empty
blocked_tokensA list of tokens (can appear in the middle of words) that are blacklisted. Also includes attachment names.list(str)empty
words_channel_whitelistArray of channels to whitelist for blocked words and tokens.list(snowflake)empty
blocked_mentionsA list of blacklisted mentions. See "Blocked Mention Tokens" for setup details.list(str)empty
mention_channel_whitelistArray of channels to whitelist for blocked mentions.list(snowflake)empty
filter_all_capsWhether to filter messages that contain a certain number of consecutive all capital letters. Spaces in messages are ignored when counting.boolfalse
all_caps_min_char_lengthMinimum length of consecutive all capital letters to censor.int5
all_caps_min_message_countMinimum number of violating messages in all_caps_interval trigger the censor.int3
all_caps_intervalSeconds in which over all_caps_min_message_count of messages will trigger the censor.int30
all_caps_channel_whitelistArray of channels to whitelist for all caps filter.list(snowflake)empty
blocked_nicknamesA list of names (can appear in the middle of nicknames) that are blacklistedlist(str)empty
block_zalgo_nicknamesWhether to filter nicknames with zalgo textboolfalse
hoist_blacklistA list of banned nickname prefixes.list(str)empty
message_char_limitMaximum allowed message length. If set to 0, no limit is set.int0
char_limit_channel_whitelistArray of channels to whitelist for message character limit.list(snowflake)empty
warn_on_censorWhether to automatically warn a user when their name or message is censored.boolfalse
mute_violationsEnable ability to mute a user after a set number of violations.boolfalse
mute_violations_countNumber of violations that can be accrued in mute_violations_interval before muting.int3
mute_violations_intervalSeconds within which a user with over mute_violations_count violations will trigger a mute.int10
mute_violations_durationSeconds to mute a user with sufficient violations.int300
antiraidA single antiraid configuration.dictNone

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

TokenDescriptionExample
{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

OptionDescriptionTypeDefault
countNumber of members that must join guild within interval to trigger antiraid.int5
intervalSeconds within which the count of members trigger the antiraid.int60
key_durationSeconds a user is remembered after joining. This should be larger than interval.int600
lockdown_durationSeconds that guild should be locked down with antiraid measures.int600
raidroleRole ID applied to all users during antiraid measures.snowflakeempty
notifyroleRole ID that should be notified when antiraid is automatically triggeredsnowflakeempty
raid_actionAction type to take on users when antiraid is triggered. Valid actions: ROLE, KICK, TEMPBAN, BANstrROLE
raid_action_durationDuration of raid_action TEMPBAN punishment. Durations can be integers which are parsed by seconds or duration strings. e.g. '10s', '5m', '2h5m'str300s
raid_action_notifyWhether or not to send a DM to users with antiraid measures applied.boolFalse
raid_action_reasonReason sent by DM to users with antiraid measures applied. Notification formatting is taken from the notify config in the infractions plugin if set.strANTIRAID

How Antiraid works

  1. Antiraid measures are enabled once more then count number of joins are detected within interval seconds. The lockdown_duration begins.
  2. All users in the join table for the key_duration will have the raid_action retroactively applied.
  3. All users that join during lockdown_duration will have the raid_action applied.
  4. Antiraid measures will stop once the lockdown_duration expires.
  5. 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.
caution

The modlog plugin will need to be configured with RAID logs for proper notifyrole alerts.

info

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