# BaseHandler

`class` in `gateway` · v0.5.1

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

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

### 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
```
