Message filters

Block links, invites, banned words, music files and mass pings per channel, and choose what happens to whoever posts them.

The message filters delete messages and, optionally, punish whoever sent them. Most of them are set per channel, so you can allow links in one place and block them everywhere else. The banned-word list is the exception and applies across the whole server. Everything here needs the Manage Messages permission.

Block something in a channel

The per-channel filters all share one shape. Turn one on for a single channel or for every channel at once, and turn it off the same way.

,filter <type> on <#channel|all> [++punish <punishment>]
,filter <type> off <#channel|all>
FilterCommandDeletes
Links,filter linksany message containing a link
Invites,filter invitesDiscord invites to other servers
Music files,filter mp3attachments ending .mp3, .wav, .m4a, .flac, .ogg, .aac, .wma, .opus
Mass mentions,filter mentionmessages pinging at least ++threshold people
Image only,filter wordsany message with no attachment

filter words is the image-only filter

It is the one command name on this page that does not describe what it does. ,filter words on #media makes #media an image-only channel — anything posted without an attachment is deleted. The banned-word list is ,filter add, covered below.

An invite to your own server is not treated as an invite. Mass mentions take ++threshold <number> for how many pings are too many.

Ban a word across the server

The word list is separate, and it applies everywhere rather than per channel.

,filter add <word> [punishment]
,filter remove <word>

,filter add takes a word of at least two characters and an optional punishment. Give no punishment and the message is deleted, with nothing happening to whoever sent it.

A word matches anywhere inside a message, so a short entry catches longer words that contain it. Adding ass also catches "class" and "passenger". Prefer whole words you actually mean.

Edits are re-checked, so changing a message after it is posted does not get a banned word past the filter.

,filter list shows the words you have added. ,filter clear empties the list. ,filter type shows which channel filters are on, and where.

Decide what happens to the sender

Every filter deletes the message. The punishment is what happens to the person on top of that, and it is optional.

PunishmentBot needs
nonenothing — the message is deleted and that is all
warnnothing
muteManage Roles, plus a mute role
jailManage Roles, plus a jail role
stripstaffManage Roles, plus a staff-role list
kickKick Members
banBan Members

Set the roles that mute, jail and stripstaff depend on with ,config muterole, ,config jailrole and ,staff add <role>.

A message that breaks a rule three times over still produces one punishment, not three.

Exempt the people who should be

,filter whitelist takes add, remove, list and clear, and accepts a user or a role. It covers every filter at once — there is no per-filter whitelist.

Moderators are filtered like everyone else

Holding Manage Messages does not exempt anybody. Only the server owner and whitelisted users and roles are exempt. If you want your staff to be able to post links in a filtered channel, whitelist the staff role.

What the filters can see

Forwarded messages are inspected as though their contents had been posted directly, and so is text inside an embed — a title, a description, a field or a footer. A banned word or an invite hidden in one of those is treated the same as one typed in the message.

Commands that turn something a member supplied into text the bot then posts, such as a voice-note transcription, have their output redacted against the link, invite and word filters before it is sent. That redaction hides the text and never punishes anybody, because a transcript is a guess at what somebody said rather than something they typed.

Common issues

A message was deleted but nobody was muted. The mute or jail role is missing or was deleted. Set it with ,config muterole or ,config jailrole. The bot reports the failure in your log channel rather than staying silent about it.

A whole channel emptied itself after I ran ,filter words. That is the image-only filter. Turn it off with ,filter words off <#channel>.

Adding a word deleted my own message. It should not — the ,filter command itself is exempt from the word filter. If a different command's message is being caught, whitelist the role that runs it.

Staff keep getting caught. Whitelist them with ,filter whitelist add <role>. A permission alone never exempts anybody.

The invite filter is deleting invites to my own server. The bot needs Manage Server to read your server's own invite list. Without it, it cannot tell your invites apart from anybody else's and deletes them all.

A link filter is catching something that is not a link. Turn the filter off for that channel and use the word list instead, which matches exactly what you type.