I wanted to pull my bot from one of my old servers but still keep it protected from invite link spam, so I pulled the Regex I used in my bot, split it to two lines, and formatted (and simplified) it for Discord.
(discord\s?\.\s?gg\s?\W)
((discordapp|discord)\s?\.\s?co(m)?\s?\W\s?(invite|servers)\s?\W)
These two lines should block just about any typical invite-link spam attack, from any of the known invite links, as well as spaces between periods which I've seen before, and you could technically change each \s?
with .
and filter for any character separating each period.
To use them, simply go to Server Settings > AutoMod > ⊕ Create Custom Keyword Rule, click Use regex patterns for advanced matching (optional), and apply both to the box. You can then choose to block message, send an alert to a channel, or timeout a user as per the capabilities of AutoMod.
If anyone can improve upon it, please do, and please share!
That should block any of the following:
Subreddit
Post Details
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/discordapp/...