> For the complete documentation index, see [llms.txt](https://tchat.tect.host/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tchat.tect.host/anti-advertising/configuration.md).

# Configuration

## General

```yml
modules:
  # Detects and blocks/censors IP addresses, domain names and URLs in chat
  #
  # Anti advertising module loaded from modules/antiadvertising.yml
  anti-advertising: true
```

* modules.anti-advertising: Enable/disable the module

***

## Module

#### Action

```yml
# What to do when an advertising word is detected:
# - CENSOR: Replace only the matched characters with censor-char
# - BLOCK: Cancel the message entirely
action: BLOCK
```

* BLOCK: Cancels the message.
* CENSOR: Replace the uppercase letters with the 'censor-char' character.

#### Censor-char

```yml
# Only used if action = 'CENSOR'
censor-char: "*"
```

* The censor character for the 'CENSOR' action.

#### Filters

```yaml
# Enable/disable the anti advertising filters
filters:

  # Examples: 192.168.1.1, 192.168.1.
  ipv4: true

  # Examples: 2001:db8::1, [::1]:25565
  ipv6: true

  # Examples: play.hypixel.net
  domains: true

  # Examples: www.example.com, https://example.com
  urls: true
```

* filters.ipv4: Enable/disable the IPv4 filters, example: 1.1.1.1, 192.168.0.1, 172.18.0.1, etc.
* filters.ipv6: Enable/disable the IPv6 filters, example: ::1, fd12:3456:789a::1, 2001:db8:85a3::8a2e:370:7334
* filters.domains: Enable/disable the domains filters, example: google.com, spigotmc.org, papermc.io
* filters.urls: Enable/disable the urls filters, example: <https://google.com>, <https://spigotmc.org>, <https://papermc.io>

#### Whitelist

```yaml
# Whitelist domains from all the filters
whitelist:

  # To disable this option:
  #domains: []
  domains:
    - tect.host
```

* Here you can exclude domains from the filters.

#### Custom regex

```yaml
# Custom regex patterns.
# If the pattern is invalid the plugin will use the default regex (and will send a warning in the console)
#
patterns:
  ipv4: "(?<![\\w.])(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)(?::\\d{1,5})?|(?=\\s|$))(?![\\w.])"
  ipv6: "(?i)(?:\\[?[0-9a-f]{1,4}(?::[0-9a-f]{0,4}){2,7}]?|::(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4}|[0-9a-f]{1,4}::(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})(?::\\d{1,5})?"
  domain-url: "(?i)(?:https?://|ftp://|www\\.)?(?:[a-z0-9](?:[a-z0-9\\-]{0,61}[a-z0-9])?\\.)+(?:com|net|org|gg|io|me|co)(?:/\\S*)?"
```

* By adding this to the settings, you can customize the regex filters that TChat uses for each filter.
