# BaseHandler

`class` in `gateway` · v0.6.0

<https://docs.seedcord.org/packages/gateway/0.6.0/classes/base-handler>

The gateway base, fixes the core base's `TCore` to the gateway [`Core`](/packages/gateway/0.6.0/interfaces/core) and adds the `getEvent` gate hook.

```ts
abstract class BaseHandler<
    ValidEvent extends ValidEventTypes
> extends BaseHandler<ValidEvent, Core>
```

## Constructors

### constructor

```ts
protected BaseHandler(
    event: Event,
    core: TCore,
    dispatch: DispatchContext,
    channel?: LoggerChannelId
)
```

Constructs a new instance of the `BaseHandler` class

## Properties

### core

```ts
readonly core: TCore
```

### dispatch

```ts
protected readonly dispatch: DispatchContext
```

The bag for this dispatch. Each interaction gets its own. Every handler for one event shares a single bag.

### event

```ts
protected readonly event: Event
```

### logger

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

## Methods

### execute

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

Holds the main logic of your handler. The dispatcher calls it after the handler's gates pass, so a gate that refuses stops `execute()` from running.

### getEvent

```ts
public getEvent(): ValidEvent
```
