<palign="center">A progressive <ahref="http://nodejs.org"target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<ahref="https://opencollective.com/nest#backer"target="_blank"><imgsrc="https://opencollective.com/nest/backers/badge.svg"alt="Backers on Open Collective"/></a>
<ahref="https://opencollective.com/nest#sponsor"target="_blank"><imgsrc="https://opencollective.com/nest/sponsors/badge.svg"alt="Sponsors on Open Collective"/></a>
You can decorate any `Telegraf` method with `@TelegramActionHandler` decorator.
```typescript
/* bot.service.ts */
import { Injectable } from '@nestjs/common'
import { TelegrafTelegramService } from 'nestjs-telegraf'
import { ContextMessageUpdate } from 'telegraf'
@Injectable()
export class BotService {
/* This decorator handle /start command */
@TelegramActionHandler({ onStart: true })
async onStart(ctx: ContextMessageUpdate) {
await ctx.reply('/start command reply')
}
}
```
##### Today available actions for decorator:
- [`onStart`](https://telegraf.js.org/#/?id=start) Handler for /start command.
- [`command`](https://telegraf.js.org/#/?id=command) Command handling.
- [`message`](https://telegraf.js.org/#/?id=hears) Registers middleware for handling text messages.
- [`action`](https://telegraf.js.org/#/?id=action) Registers middleware for handling `callback_data` actions with regular expressions.
#### Telegraf middlewares usage
See https://github.com/bukhalo/nestjs-telegraf/issues/7#issuecomment-577582322
### Telegram
#### Telegram methods usage
Inject `TelegrafTelegramService` from `nestjs-telegraf` package for use [Telegram instance](https://telegraf.js.org/#/?id=telegram) from `telegraf` package.
```typescript
/* bot.service.ts */
import { Injectable } from '@nestjs/common'
import { TelegrafTelegramService, TelegramActionHandler } from 'nestjs-telegraf'
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).