# Filter

### Constructor

```javascript
new antispam.filter(options);
```

| Parameter | Type                                                                                              | Description                     |
| --------- | ------------------------------------------------------------------------------------------------- | ------------------------------- |
| options   | [filteroptions](https://imthehumanoid.gitbook.io/antispammer/docs/filter/filteroptions "mention") | Options for an antispam filter. |

### Methods

#### .setTime(time)

Set the amount of time in ms.

| Parameter | Type   | Description               |
| --------- | ------ | ------------------------- |
| time      | number | The amount of time in ms. |

returns object

#### .setMax(threshold)

Set the threshold of inputs allowed.

| Parameter | Type   | Description                             |
| --------- | ------ | --------------------------------------- |
| threshold | number | The threshold of inputs per ID allowed. |

returns object

#### .setOnGood(onGood)

Set the function of what to do on an input that is not considered spam.

| Parameter | Type     | Description                                                |
| --------- | -------- | ---------------------------------------------------------- |
| onGood    | function | The function used on an input that is not considered spam. |

returns object

#### .setOnBad(onBad)

Set the function of what to on an input that is considered spam.

| Parameter | Type     | Description                                            |
| --------- | -------- | ------------------------------------------------------ |
| onBad     | function | The function used on an input that is considered spam. |

returns object

#### .check(id)

Adds a use to a user by ID and acts upon it depending on if it is considered spam or not.

| Parameter | Type   | Description                     |
| --------- | ------ | ------------------------------- |
| id        | string | A string that identifes a user. |

returns function

#### .clear(id)

Clears all uses from a user by ID.

| Parameter | Type   | Description                     |
| --------- | ------ | ------------------------------- |
| id        | string | A string that identifes a user. |

returns void

#### .has(id)

Checks if a user is spamming by ID.

| Parameter | Type   | Description                     |
| --------- | ------ | ------------------------------- |
| id        | string | A string that identifes a user. |

returns function

#### .list()

Gets the list of IDs put into the filter.

returns array
