Affiliate Cleanup
Delete messages that contain affiliate or tracking links, alert moderators, and ask the author to post a clean link.
Why Use This Feature?
- Removes referral and tracking links in every channel, so members can't earn commissions from your community.
- Names every matched platform in one alert, so moderators see what was removed.
- Tells the author privately how to repost, so a useful link can come back without the tracking.
How It Works
- What it reads — New messages and edits that change a message's text, from members other than bots, that a regex rule hasn't already deleted. The bot sees edits only for messages it has seen since its last reconnect, up to the 200 most recent in each channel.
- How it matches — Every platform pattern runs against the message text as written, and the bot collects every platform that matches.
- What it does — When at least one platform matches, the bot posts the alert, sends the direct message, and then makes one attempt to delete the message.
The alert is an embed titled "Affiliate content removed" that shows the author, the channel ID, the matched platforms, an excerpt of up to 700 characters, and a link to the message. It posts before the delete, so it appears even when the delete fails.
warning
The panel labels the channel setting Monitored channel, but the feature checks every channel. That setting is only the alert channelWhere a feature posts its reports for moderators, and leaving it out skips the alert.
Requirements
- Message Content intentLets the bot read what messages actually say — Switch on this privileged intentAn intent you must switch on in the Developer Portal first for your application in the Discord Developer Portal.
- Channel permissions — The bot needs View Channel and Manage Messages in every channel, and Send Messages and Embed Links in the alert channelWhere a feature posts its reports for moderators.
Settings
| Field | Description |
|---|---|
Link patterns (platforms) | 1 to 100 platforms, each with a Platform name of up to 100 characters and a Regular expression. |
Monitored channel (channel) | Optional alert channelWhere a feature posts its reports for moderators for removal alerts. |
Member notice → Text (direct-message-payload.content) | Optional direct message of up to 2,000 characters, sent as written without filling in message variables. |
Exempt rolesRoles whose members a rule skips (excluded-roles) | Optional list of 1 to 100 roles whose members the feature skips. |
Example
{
"platforms": [
{ "platform": "Amazon", "regex": { "pattern": "[?&]tag=", "flags": "i" } }
],
"channel": { "channel-id": "123456789012345678" },
"direct-message-payload": { "content": "Please repost the link without the affiliate tag." }
}
Limits
- Platforms — Up to 100.
- Excerpt — Up to 700 characters of the message.
Troubleshooting
- The alert says "removed" but the message is still there — The bot lacks Manage Messages in that channel.
- A member got two direct messages — A regex rule matched but couldn't delete the message, so affiliate cleanup ran too.
- Moderators' links are removed — Administrators aren't skipped automatically, so add their roles to Exempt rolesRoles whose members a rule skips.
Changes from the legacy bot
The legacy botThe old v3.4.3 bot that ran from a config.json file skipped anyone with the Administrator permission, and it sent the alert, the direct message, and the delete at the same time. The rewrite skips only excluded rolesRoles whose members a rule skips and runs those steps in order.