Guide
Set up the invite filter
The invite filter removes invitations to other Discord servers. It is off on a new server. You choose between two modes and decide which roles, invite codes and servers are let through.
How it works
SfwBot reads each message for Discord invite links. It recognises the usual forms, such as discord.gg and discord.com/invite links and common short domains, and it also catches links written with look-alike characters.
When it finds an invite, it checks the exceptions first: is the member in an allowed role, is the code on your allowed list, does the invite lead to your own server. Only then does it apply the mode you chose:
| Mode | What it does |
|---|---|
| Zero tolerance | Every invite that is not an exception is removed. This is the default. |
| Rate based | A member may post a set number of invites within a time window. Invites beyond that are removed. |
The invite filter is a text check. It uses no credits. For an overview of the feature see invite filter.
Set it up in the dashboard
The [settings reference](/docs/settings) lists the defaults and allowed values of each option.
Open Spam protection, Invite filter
In the dashboard, open your server and go to Spam protection, then Invite filter.
Switch it on
Turn on Filter server invites.
Choose how strict
Under How strict, pick Zero tolerance or Rate based. For rate based, set Invites allowed and Window in minutes.
Set exceptions and consequences
Under Exceptions and consequences, decide whether to Allow invites to this server and whether a member who breaks the rule is timed out, and for how long.
Add allowed roles and codes
Under Allowed roles, pick the roles that may post any invite. Under Allowed invite codes, add the codes of partner servers, with an optional description so you remember why.
Save
Choose Save changes. The filter applies to new messages at once.
The `/settings` command
/settings has the page Invites and spam with an invite filter section. From there you can switch the filter on or off, change the mode, the rate and the timeout, allow your own server's invites and manage allowed roles and invite codes. It needs the Manage Server permission.
The same page has a section for the spam filter. See the command reference.
What happens on a violation
- The message is deleted.
- The member is timed out, if you switched the timeout on.
- A log entry is posted to your log channel. See logging.
- Trust is deducted, if you use trust and strikes. Invite links are a low tier violation and count once per message. You can change the tier or switch the violation off in the trust settings.
- The member is told about the trust loss, if trust is on and set to tell members. Members who opted in with
/dmsget a direct message. Others get a short channel notice that deletes itself, unless you switched the notice off in General settings.
What the log keeps from the message is deleted after 30 days.
Exceptions
The invite filter has three kinds of exception. It has no exempt channels.
Allowed roles
Members with one of these roles can post any invite. A good fit for moderators and partner managers.
Allowed invite codes
Invites with these codes pass for everyone. Add the code or paste the whole invite link.
Your own server
Invites that lead to this server pass while Allow invites to this server is on.
Troubleshooting
- Invites are not removed. Check that Filter server invites is on, that the member has no allowed role and that the code is not on the allowed list. In rate based mode the first invites within the window are allowed on purpose.
- The bot cannot delete the message. It needs Manage Messages in that channel. Run
/statusto see where it is missing. - The timeout is not applied. The bot needs the permission to time out members, and its role must be above the member's highest role. Discord does not let a bot time out the server owner or administrators.
- An invite to your own server was removed. Check that Allow invites to this server is on. If it still happens, add the invite code to the allowed list.
- No log entries. No log channel is set, or the bot cannot post there.
Common questions
Which mode should I choose?
Zero tolerance suits most servers. Rate based is useful where members share an invite now and then and you only want to stop mass advertising.
Does the filter catch invites hidden behind other links?
It looks for Discord invite links in the message text, including look-alike spellings. A link shortener that hides an invite is not resolved. Link protection and AutoMod cover other kinds of links.
Does the invite filter use credits?
No. Only AI scans of media use credits.