# PluginHost

`class` in `core/plugin` · v0.11.0

<https://seedcord.org/docs/packages/core/0.11.0/classes/plugin-host>

Base class for a plugin host.

```ts
abstract class PluginHost<
    BotT extends Transport,
    BotRt extends Runtime
> implements CoreBase
```

## Constructors

### constructor

```ts
PluginHost(transport: BotT, runtime: BotRt)
```

Constructs a new instance of the `PluginHost` class

## Properties

### applicationId

```ts
public abstract readonly applicationId: string
```

### bus

```ts
public abstract readonly bus: Bus
```

### config

```ts
public abstract readonly config: Config
```

### rateLimiter

```ts
public abstract readonly rateLimiter: IRateLimiter
```

### rest

```ts
public abstract readonly rest: REST
```

## Methods

### attach

```ts
public attach<Key, Ctor>(
    this: this,
    key: AttachKeyAssert<Key, this>,
    Plugin: AttachableCtor<Ctor, BotT, BotRt>,
    args: PluginArgs<Ctor>
): this & Attached<Key, InstanceType<Ctor>>
```

Attaches a plugin under `key`. Read the instance back as `core[key]`. `seedcord codegen`
writes the `Core` augmentation that types it there.

Put one dot in the key to nest the plugin under a group. `'services.users'` reads back as
`core.services.users`. Each name holds one plugin or one group.

Startup runs each plugin's `init()` in attach order within its phase. A node bot starts in
`start()`. An edge bot starts on its first request.

Attaching a plugin whose `transport` or `runtime` differs from this host fails to compile.
Your constructor takes `CoreBase` as its first parameter (you don't need to pass it though).
A narrower one fails to compile here.
