> For the complete documentation index, see [llms.txt](https://docs.drakodevelopment.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.drakodevelopment.net/moderation-and-roles/scam-blocker.md).

# Scam Blocker

Scam Blocker deletes messages that match configured scam text patterns or known blocked images. It checks new messages and edits, including supported image attachments and link previews.

## Set up through the dashboard

{% stepper %}
{% step %}

### Open Scam Blocker

Select your server and open **Moderation → Scam Blocker**.
{% endstep %}

{% step %}

### Configure blocked scam messages

Review **Blocked scam messages**. Add or edit text patterns, or clear the list if you only want image scanning.
{% endstep %}

{% step %}

### Configure blocked images

Review **Blocked images**. Use **Upload images** to add reference images, remove ones you do not want to block, or restore a removed starter image.
{% endstep %}

{% step %}

### Set image matching and size limits

Set **Minimum image match (%)**. The default is **95%**.

Set **Maximum image size (MB)**. The default is **25 MB**, with an allowed range of **1–50 MB** per image.
{% endstep %}

{% step %}

### Review exceptions

Review bypass roles, bypass permissions, allowed channels and allowed categories. Members with **Manage Messages** bypass scanning by default.
{% endstep %}

{% step %}

### Configure logging

Under **Logging**, optionally select **Log channels** and customize **Scam Blocker log design**.
{% endstep %}

{% step %}

### Enable and save

Turn on **Enable Scam Blocker** and choose **Save changes**.
{% endstep %}
{% endstepper %}

{% hint style="success" %}
Use `/image-filter add` if you don't own the dashboard
{% endhint %}

Server owners and administrators can manage images. The bot needs **View Channel** and **Manage Messages** where it scans and deletes messages, plus permission to send messages in any selected log channels.

## Configure using YAML

Edit the existing `ImageFilter` section in `config/modules/moderation.yml`. Keep the other sections in that file. Do not rename the key to `ScamBlocker`, add a duplicate `ImageFilter:` key, or wrap it in `Moderation:`.

This example enables text and image matching at 95%, allows images up to 25 MB, and sends detection results to a staff log channel. Replace the example log channel ID and keep Discord IDs in quotation marks.

```yaml
ImageFilter:
  Enabled: true
  MatchPercentage: 95
  MaxImageSizeMB: 25

  Patterns:
    - 'CyberLeek will stream GTA VI for * in the voice channel'

  BypassRoles: []
  BypassPerms:
    - ManageMessages
  WhitelistChannels: []
  WhitelistCategories: []

  Action: Delete
  LogsChannelID:
    - "234567890123456789" # Staff log channel.

  Log:
    Components:
      - Type: container
        AccentColor: "#EF4444"
        Components:
          - Type: text_display
            Content: |-
              ## Scam Blocker
              **Member:** {memberMention}
              **Channel:** {channelMention}
              **Match type:** {matchType}
              **Reason:** {reason}
              **Action:** {action}
              **Message ID:** {messageId}
          - Type: separator
            Divider: true
            Spacing: small
          - Type: text_display
            Content: '-# {guildName} · {timestamp}'
```

Add image references through the dashboard or `/image-filter add`. They are saved separately for each server in MongoDB, rather than as file paths or URLs in this YAML section.

Valid module YAML changes reload automatically during normal bot operation. Saved per-server settings take precedence over the local defaults. Use the dashboard or `/image-filter configure` when changing a server that already has its own moderation settings.

### Settings reference

| Setting               | Description                                                                                                                                      |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Enabled`             | Enables both text matching and image scanning. The default is `false`.                                                                           |
| `MatchPercentage`     | Minimum image similarity required to delete a message. Whole number from `1` to `100`; default `95`. Does not affect text matching.              |
| `MaxImageSizeMB`      | Maximum size of each uploaded reference or scanned image. Whole number from `1` to `50`; default `25`.                                           |
| `Patterns`            | Text rules checked against message content. Use `[]` to scan images only.                                                                        |
| `BypassRoles`         | Members with any listed role are exempt. Use `[]` for no role-based exceptions.                                                                  |
| `BypassPerms`         | Members with any listed Discord permission are exempt. The default includes `ManageMessages`. Use Discord permission identifiers without spaces. |
| `WhitelistChannels`   | Channels excluded from scanning. Excluding a parent channel also excludes its threads.                                                           |
| `WhitelistCategories` | Categories excluded from scanning, including their channels and threads.                                                                         |
| `Action`              | Must be `Delete`. Scam Blocker does not warn, time out, kick or ban members.                                                                     |
| `LogsChannelID`       | Optional additional log channel IDs. Use `[]` to disable dedicated alerts. Shared automatic moderation logs still apply.                         |
| `Log`                 | The component message design used for Scam Blocker alerts in dedicated and shared log channels.                                                  |

For ID lists, replace `[]` with values such as `["345678901234567890"]`. An empty whitelist means no channels or categories are excluded by that setting. It does not disable other bypass rules.

## Text patterns

Patterns are checked against new messages and edits. Matching ignores case and can find a phrase within a longer message; it does not require the whole message to be identical.

| Pattern type       | Example                                                   | How it works                                                                           |
| ------------------ | --------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| Literal text       | `claim your free example reward`                          | Matches that phrase wherever it appears.                                               |
| Wildcard           | `CyberLeek will stream GTA VI for * in the voice channel` | `*` matches variable text between the fixed parts, such as plain or linked “everyone”. |
| Regular expression | `regex:claim\s+your\s+free\s+example\s+reward`            | Uses a case-insensitive regular expression after the `regex:` prefix.                  |

The CyberLeek rule is included in the default configuration. The other examples only demonstrate syntax; choose phrases that are appropriate for your server. Invalid regular expressions are rejected when saving. In YAML, single-quote regex strings so backslashes remain literal.

To use image scanning only, change the existing setting to `Patterns: []`. There is no separate text-rule enable switch: both text matching and image scanning use `ImageFilter.Enabled` and the same exceptions.

## Manage blocked images

The dashboard gallery includes bundled starter images and your server's uploaded references. Removed starter images remain visible with a restore control. Removed custom images can be uploaded again.

* Upload up to **10 images at a time** through the dashboard.
* Store up to **500 custom reference images per server**, in addition to the starter images.
* Supported formats are **JPEG, PNG, WebP, GIF and AVIF**, up to **20 megapixels**, within the configured size limit.
* Animated images use the **first frame only**. Videos are not scanned as image references.
* References, preview thumbnails and starter-image selections persist across bot restarts.

{% hint style="warning" %}
Images shown in this gallery are known scam references. Do not follow links or visit websites pictured in them.
{% endhint %}

### Choose a match threshold

Start with the default **95%**. A lower percentage accepts more visual differences, which can catch modified images but can also match unrelated content. A higher percentage requires a closer visual match.

The score measures similarity to a reference image. It is not a confidence score that an arbitrary image is a scam, and a 100% setting is not a byte-for-byte file comparison. Crops, overlays and other substantial changes can prevent a match.

Review the match percentage and threshold in detection logs when adjusting the setting. Increasing the maximum file size only allows larger files to be scanned; it does not change matching sensitivity.

### Discord commands

The server owner or an administrator can use these commands:

| Command                                                             | Purpose                                                                                        |
| ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `/image-filter add`                                                 | Attach a reference using the required `image` option. Optionally give it a short `name`.       |
| `/image-filter list`                                                | Show settings and active image IDs. Use the optional `page` option for more results.           |
| `/image-filter remove id:IMAGE_ID`                                  | Remove a custom image or disable a starter image. Replace `IMAGE_ID` with an ID from the list. |
| `/image-filter configure enabled:true percentage:95 max-size-mb:25` | Enable Scam Blocker and set image similarity and size limits for this server.                  |
| `/image-filter configure enabled:false`                             | Disable both text and image matching for this server.                                          |

The dashboard and commands use the same image collection. Text patterns, exceptions and log designs are managed in the dashboard or YAML. If the command is unavailable, check that `image-filter` is enabled in the bot's command settings.

## Logging and message design

Under **Moderation → Scam Blocker → Logging**, choose optional **Log channels**. Alerts include the member, source channel, message ID, match details and deletion outcome.

The shared **Automatic action notices** log channels also receive these alerts. A channel present in both lists receives one copy. Leaving Scam Blocker's log list empty does not disable shared logs.

Use **Scam Blocker log design** to edit text, colours, layout and images, then **Save changes**. The same design is used for dedicated and shared Scam Blocker alerts. Other automatic moderation messages keep their own designs.

| Placeholder                                                          | Value                                                                        |
| -------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| `{memberId}`, `{memberMention}`, `{memberName}`, `{memberAvatarURL}` | Details of the member whose message matched.                                 |
| `{channelId}`, `{channelMention}`, `{channelName}`                   | Source channel details.                                                      |
| `{guildId}`, `{guildName}`                                           | Server details.                                                              |
| `{messageId}`                                                        | ID of the matched message.                                                   |
| `{reason}`                                                           | Detection reason, including image match details when relevant.               |
| `{action}`                                                           | Actual outcome, such as `Delete` or a message explaining a deletion failure. |
| `{matchType}`                                                        | `Text` or `Image`.                                                           |
| `{pattern}`                                                          | Matching text rule, or `Not applicable` for an image match.                  |
| `{imageId}`                                                          | Matching reference image ID, or `Not applicable` for a text match.           |
| `{matchPercentage}`                                                  | Image similarity without a `%` sign, or `Not applicable` for a text match.   |
| `{threshold}`                                                        | Configured minimum image match percentage, without a `%` sign.               |
| `{timestamp}`                                                        | Detection time as a formatted Discord timestamp.                             |

Mentions in these logs do not ping members. The shared **DM affected member** setting does not send a DM for Scam Blocker deletions.

## What gets scanned?

Scam Blocker checks message text, supported image attachments, Discord-hosted image links and image previews that Discord makes available. It also handles later message updates when a link preview arrives after the original message.

It does not inspect every linked website or scan historical messages in bulk when enabled. External preview images are retrieved through Discord's image proxy. If there is no accessible supported image, there is nothing to compare against the blocked references.

Images that are unavailable, oversized, unsupported or cannot be decoded are skipped. Other images in the same message can still be checked. If a text rule or an image matches, the bot attempts to delete the entire message.

Bot messages, webhooks and messages from the server owner are excluded. Bypass roles, bypass permissions and channel/category exceptions also apply. Staff with Manage Messages are exempt by default.

## Troubleshooting

<details>

<summary>An uploaded image was not blocked</summary>

Uploading a reference does not enable the feature. Turn on Scam Blocker and save. Check exemptions, similarity and image limits.

</details>

<details>

<summary>My administrator test was ignored</summary>

Server owners and members with bypass permissions are exempt. Manage Messages is a default bypass.

</details>

<details>

<summary>A link was not blocked</summary>

The feature needs matching message text or a supported, accessible image. A website URL alone is not a general scam-domain rule.

</details>

<details>

<summary>Some versions of an image are missed</summary>

Cropping, overlays and other edits can reduce similarity. Add a representative reference or carefully adjust the threshold after reviewing logs.

</details>

<details>

<summary>Uploading a reference fails</summary>

Check its format, megapixel count, configured size limit, duplicates and the 500-image limit. Image uploads are unavailable in demo/trial mode.

</details>

<details>

<summary>Matching messages remain visible</summary>

Check the bot's Manage Messages permission. The log reports whether deletion was unavailable or failed.

</details>

<details>

<summary>No dedicated alert appears</summary>

Choose Log channels and allow the bot to send there. Shared automatic moderation logs are configured separately.

</details>

<details>

<summary>Text rules still run after all images are removed</summary>

Text rules are independent of the image collection. Clear Patterns for image-only operation, or disable Scam Blocker to stop both.

</details>

<details>

<summary>YAML edits do not change this server</summary>

Saved per-server moderation settings take precedence over local defaults. Edit the server's settings and check configuration errors in the bot log.

</details>
