# InteractionMiddleware

`class` in `gateway` · v0.4.1

<https://docs.seedcord.org/packages/gateway/0.4.1/classes/interaction-middleware>

Base class for interaction middleware

Middleware runs before interaction handlers and can modify behavior or block execution. Unlike handlers, middleware should not send responses directly.

```ts
abstract class InteractionMiddleware<
    Repliable extends Repliables
> extends BaseHandler<Repliable>
```

## Constructors

### constructor

```ts
InteractionMiddleware(event: Repliable, core: Core)
```

Constructs a new instance of the `InteractionMiddleware` 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
getEvent(): ValidEvent
```
