# WebhookLog

`class` in `core` · v0.2.1-next.0

<https://docs.seedcord.org/packages/core/0.2.1-next.0/classes/webhook-log>

Base class for subscribers that deliver their event to a Discord webhook.

Declare the url's environment variable with `@WebhookUrl` and implement [`report`](/packages/core/0.2.1-next.0/classes/webhook-log#report). Url resolution, validation, sender reuse, and sending run in the base. When the variable is unset the reporter is skipped at registration with a boot warning.

```ts
abstract class WebhookLog<
    KeyOfSubscribers extends SubscriptionKey,
    TCore extends CoreBase
> extends Subscriber<KeyOfSubscribers, TCore>
```

## Constructors

### constructor

```ts
Subscriber(data: AllSubscriptions[KeyOfSubscribers], core: TCore)
```

Instantiates the subscriber with event data and core.

## Properties

### core

```ts
protected readonly core: TCore
```

### data

```ts
protected readonly data: AllSubscriptions[KeyOfSubscribers]
```

### logger

```ts
protected readonly logger: Logger
```

## Methods

### execute

```ts
public async execute(): Promise<void>
```

### report

```ts
public abstract report(
    suppressed: number
): WebhookReport | Promise<WebhookReport>
```

Builds the message for one published event.

### throttleKey

```ts
protected throttleKey(): string | null
```

Events sharing this key collapse into one card per minute. Return `null` to send every event.
