nestjs-telegraf/website/docs/installation.md

29 lines
699 B
Markdown
Raw Normal View History

---
id: installation
title: Installation
sidebar_label: Installation
slug: /
---
```bash
2023-07-23 15:42:01 +03:00
$ npm i @maks1ms/nestjs-telegraf telegraf
```
2021-02-14 23:59:26 +03:00
Once the installation process is complete, we can import the `TelegrafModule` into the root `AppModule`.
2021-02-14 23:59:26 +03:00
```typescript title="src/app.module.ts"
import { Module } from '@nestjs/common';
2023-07-23 15:42:01 +03:00
import { TelegrafModule } from '@maks1ms/nestjs-telegraf';
@Module({
imports: [
TelegrafModule.forRoot({
token: 'TELEGRAM_BOT_TOKEN',
})
],
})
export class AppModule {}
```
The `forRoot()` method accepts the same configuration object as Telegraf class constructor from the Telegraf package, as described [here](https://telegraf.js.org/#/?id=constructor).