# BaseHandler

`class` in `gateway` · v0.9.0

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

The gateway base, fixes the core base's `TCore` to the gateway [`Core`](/docs/packages/gateway/0.9.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
```

### route

```ts
protected readonly route: string
```

The route that started this dispatch. Each handler base narrows it to its own routes.

## Methods

### execute

```ts
abstract execute(): Promisable<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
```
