Anti-spam and links

How to Block Links in Discord (Invites, Scam Links, or All Links)

To block links in Discord, use an AutoMod keyword rule for http* or a regex rule for https?://. A domain block list blocks specific sites, and an anti-link bot such as Security Bot deletes invites and known scam domains. A plain http keyword misses https:// links. Channel permissions cannot block links. Removing Embed Links only hides the preview.

By Sina, Founder, Security BotUpdated (published )10 min read

What Discord can and cannot do natively

  • Embed Links permission: removes the preview card, leaves the URL clickable. Not a block.
  • AutoMod keyword rules: block messages that match a keyword, a wildcard pattern such as http*, or a regex such as https?://, before the message posts. This is the native way to block links. Each rule has an allow list of up to 100 entries for exceptions such as your own invite.
  • AutoMod Block Suspected Spam Content: catches common link spam such as fake Nitro and invite spam, but is not a general link filter.
  • Suspicious-link filter: Community servers get Discord's own filter for known malware and phishing links.
  • Verification level: delays new accounts from posting, which slows drive-by links.
  1. Open Server Settings, AutoMod and create a Custom Keywords rule.
  2. Add http* as a keyword, or https?:// as a regex pattern. A keyword without a wildcard is a whole-word match, so a plain http misses https:// links. Test with an alt account after saving.
  3. Choose the response: Block message, and optionally Send alert to a log channel and Time out member.
  4. Under Exemptions, add the roles allowed to post links (staff, trusted members) and the channels where links are fine.

Discord allows six custom keyword rules per server. Security Bot's keyword presets use the same six slots, so count the rules you made by hand before enabling them. The AutoMod page lists the rules the bot tracks.

Option 2: Block only Discord invites

Invite spam is a common link problem, and blocking every link to stop it punishes normal members. There are two ways to block only invites.

  • Security Bot's Anti Invite Link (free). Deletes every discord.gg, discord.com/invite, or discordapp.com/invite link outside the channels you whitelist, including invites to your own server. It also catches spaced-out spellings such as discord dot gg, and leaves other links alone. It does not punish or log. It only deletes.
  • A native AutoMod rule. A regex rule such as discord(\.gg|(app)?\.com/invite)/ blocks invites before they post. The rule's allow list can hold your own invite code or vanity URL so it still works.

Anti Invite Link checks regular text channels only, not threads, forum posts, announcement channels, or voice-channel chat. Members ranked above the bot, the owner, and users or roles whitelisted for the Invite-Link category are skipped. Whitelist a partnership channel if invites belong there.

Option 3: Block scam and phishing domains

Fake Nitro gifts, wallet drainers, and fake Steam logins change domains often, so a hand-made block list falls behind. Community servers already get Discord's suspicious-link filter.

Security Bot's Threat Link Guard preset (Premium) adds a bot-side check against a threat indicator list of scam and phishing domains that it refreshes every hour. It works after posting, in regular text channels. Matching messages are deleted as soon as the bot sees them, and the member can be timed out, kicked, or banned. The AutoMod page shows how many indicators are loaded.

Option 4: Block your own list of sites

The Domain Watchlist preset creates a Discord AutoMod keyword rule from the domains you paste, so those links are blocked before they post.

Mature Link Guard removes links to adult sites using a list the bot refreshes every 24 hours. Like Threat Link Guard, it runs on the bot side, deletes after posting, and uses no Discord rule slot.

Both are part of Premium. On the free tier, a keyword rule you create yourself does the same job as Domain Watchlist.

Set it up with Security Bot

  1. Turn on Anti Invite Link

    On the Anti-Nuke page enable the free Anti Invite Link rule. It deletes every Discord invite link, including your own, outside the channels you whitelist. The server owner, members ranked above Security Bot, and users or roles whitelisted for Invite-Link are skipped.

    Command: /enable action:Sending invite links

  2. Enable Threat Link Guard

    On the AutoMod page enable the scam and phishing preset (Premium). Choose a bot timeout as the follow-up action.

  3. Add a domain watchlist

    Enable Domain Watchlist (Premium) and paste any domains you want blocked outright, one per line.

  4. Optionally block all links for new members

    Enable Block Custom Words (Premium) with the regex https?://, or the keyword http*, as a block term. Exempt your verified or regular roles, so only newer accounts are link-blocked. A plain http keyword does not match https:// links.

  5. Exempt the channels where links belong

    Add your media or partners channel to the preset exemptions so the filter ignores it.

  6. Set the AutoMod log channel

    On the Logging page pick a channel for AutoMod events and watch it for false positives during the first week.

Server typeTurn onLeave off
Small community, mostly known membersAnti Invite Link, plus native Mention Spam and Spam Content rulesA blanket http* rule; it blocks the links friends share
Public gaming serverAnti Invite Link, a domain keyword rule for known spam sites, an http* block for unverified membersThreat Link Guard, unless scam links show up regularly
Crypto, NFT, or marketplace serverThreat Link Guard with ban (Premium), an http* block for everyone but staff and verified regulars, and the web check with alt blockingNothing; links are the attack surface here

Wallet drainers dressed up as mint links are the reason crypto servers block by default and allow by exception. A gaming community often gets more from invite blocking and a short domain list, because much of its link spam is people advertising other servers.

Say you run a 3,000-member server on Premium. #general should stay link-free, members share videos in #links, and staff post invites to allied servers in #partners. Here is one way to configure it on the Security Bot dashboard.

  1. On the AutoMod page enable Block Custom Words with the regex https?:// as a block term. Under exemptions add the Staff and Regular roles and the #links channel. Choose delete only as the action, so a mistake costs a message, not a timeout.
  2. On the Anti-Nuke page, enable Anti Invite Link. Then, on the Whitelists page, add #partners to the Channels: Invite-Link category and the Staff role to the Roles: Invite-Link category. Staff invites are then left alone. On the free tier, /whitelist add_channel channel:#partners category:Channels: Invite-Link does the same. On Premium, the whitelist commands only reply with a link to the dashboard.
  3. Enable Domain Watchlist and paste the two or three domains you have already seen spammed. Enable Mature Link Guard if the server is all-ages.
  4. On the Logging page set the AutoMod log channel. Links blocked by the AutoMod presets now show up there with the rule and the member. Invite deletions by Anti Invite Link are not logged.

The result:

  • Members without the Regular role cannot post any link in #general.
  • Regulars can post normal links but not invites.
  • Staff can post anything.
  • #links and #partners behave as expected.

On the free tier, you can build the same #general rule by hand in Server Settings, AutoMod, and keep Anti Invite Link for invites.

Every filter above supports exceptions. AutoMod presets (Threat Link Guard and Mature Link Guard included) and native rules have exempt roles and channels. Anti Invite Link uses the Invite-Link whitelist categories for users, roles, and channels.

A common setup: new members cannot post any link, regular members cannot post invites or scam domains, staff can post anything, and a links channel is exempt entirely. Exempt the roles rather than turning a filter off.

Common mistakes

  • Relying on Embed Links. Removing it hides the preview card. The URL stays clickable. It is a cosmetic setting, not a filter.
  • Using `http` without a wildcard. AutoMod treats it as a whole word, so https:// links pass. Use http* or the regex https?://, and test with an alt.
  • Blocking links with no exemptions. Staff get their own announcements deleted within the hour. Exempt the roles that should post links before you save.
  • Blocking invites in the partnership channel. Whitelist that channel for the invite link action instead of turning the rule off for the whole server.
  • Running out of rule slots. Discord allows six custom keyword rules and one rule each for spam, mention, flagged words, and profile. If a preset refuses to save, delete a hand-made rule you no longer need.
  • No AutoMod log channel. Without it you cannot see false positives, so the first complaint you hear is from a member whose harmless link vanished.
  • A global whitelist entry for a staff role. A global entry bypasses every anti-nuke check, including invite link deletion. Use a per-action entry on the whitelist.

What Discord AutoMod does and what the bot adds

Discord AutoMod blocks a matching message before it posts, which no bot can do after the fact. It matches keywords, wildcards, and regex, supports allow lists, can time out the member on keyword rules, and sends alerts to a channel. Discord also runs its own suspicious-link filter in Community servers.

What it does not give you is a scam list you can extend with your own feed, follow-up kicks or bans, or an invite filter that needs no rule slot.

Security Bot's free Anti Invite Link deletes invites without using a slot. On Premium, it also:

  • Creates and syncs the native AutoMod rules from presets.
  • Warns when two presets would need the same rule.
  • Adds a bot-side timeout, kick, or ban after the block.
  • Runs the threat and mature-domain feeds.

For a full comparison, read Discord AutoMod vs Security Bot.

  1. Run /lock in the flooded channel, or /lockall if it is server-wide, to stop the posting.
  2. Open the AutoMod log channel to see which accounts are posting and whether the links are invites, scam domains, or something new.
  3. Run /softban on compromised member accounts. The ban deletes their recent messages from every channel and the unban lets the real owner come back.
  4. If the links came from new joins, it is a raid. On Premium, anti-raid can time out or ban the accounts that joined during the raid window. Otherwise, ban them rather than softbanning.
  5. Add the new domain to a keyword rule or Domain Watchlist, or turn on Threat Link Guard if it is a known phishing kit, then run /unlock.

Troubleshooting

ProblemCauseFix
https:// links still get throughThe keyword is a plain http, which only matches the whole wordUse http* or the regex https?://
Links still get throughThe sender has an exempt role, or the channel is exemptCheck rule and preset exemptions and channel overrides
Your own invite gets deletedAnti Invite Link deletes every invite outside whitelisted channelsWhitelist the channel or role for Invite-Link, or use an AutoMod rule with your invite on its allow list
Legitimate links are blockedA broad link rule with no exemptionsExempt trusted roles, or switch to invite and scam filters only
AutoMod rule failed to saveSix keyword rules already existDelete an unused rule or merge terms
Bot cannot create the ruleThe bot lost Administrator (managing AutoMod needs Manage Server)Restore Administrator on the bot's role or re-invite with the default permissions

Do this with Security Bot

Discord Anti Link Bot: Remove invite spam and known scam, phishing, and adult links from your channels.

Security Bot deletes Discord invite links with a free filter. Premium adds Threat Link Guard, which deletes links to known scam, phishing, and malware domains from an hourly feed. It also adds Mature Link Guard and a Domain Watchlist rule it manages for you.

Frequently asked questions

How do I stop people from sending links in my Discord server?

Create an AutoMod keyword rule for http* (or a regex rule for https?://) with exemptions for trusted roles. On Premium, Security Bot can manage that rule and add scam-domain filters. Its invite filter is free.

Can I block links without a bot?

Yes. Discord AutoMod keyword rules with http* or the regex https?:// block messages with links before they post. A plain http keyword does not match https:// links. A bot adds invite filtering without a rule slot, scam feeds, and punishments.

How do I block Discord invite links only?

Enable Security Bot's free Anti Invite Link rule, which deletes every invite link outside whitelisted channels, including your own, and leaves normal links alone. Or create an AutoMod rule that matches invite links and put your own invite on its allow list.

Does removing Embed Links block links?

No. It only removes the preview. The URL stays clickable.

How do I block scam links automatically?

Community servers get Discord's suspicious-link filter. For more coverage, use a maintained threat feed such as Security Bot's Threat Link Guard (Premium). It refreshes its scam and phishing domain list every hour and deletes matching messages after they post.

Can I block links only for new members?

Yes. Create an AutoMod keyword rule with http* or the regex https?:// and exempt your verified or regular roles. Members without those roles are link-blocked. Everyone else is not.

Where are blocked links logged?

Native AutoMod rules can send alerts to a channel you pick. Security Bot's AutoMod presets report to the AutoMod log channel with the rule and member. A timeout, kick, or ban that follows also appears in the moderation log. Anti Invite Link deletions are not logged.

How this guide was made: drafted with AI assistance, then checked against Security Bot's source code and Discord's official help articles. Spotted something out of date? Tell us in the support server.