mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-25 23:44:39 +03:00
18 lines
551 B
Markdown
18 lines
551 B
Markdown
---
|
|
id: bot-injection
|
|
title: Bot injection
|
|
sidebar_label: Bot injection
|
|
slug: /bot-injection
|
|
---
|
|
|
|
At times you may need to access the native `Telegraf` instance. For example, you may want to connect stage middleware. You can inject the Telegraf by using the `@InjectBot()` decorator as follows:
|
|
```typescript
|
|
import { Injectable } from '@nestjs/common';
|
|
import { InjectBot, TelegrafProvider, Context } from 'nestjs-telegraf';
|
|
|
|
@Injectable()
|
|
export class BotSettingsService {
|
|
constructor(@InjectBot() private bot: TelegrafProvider<Context>) {}
|
|
}
|
|
```
|