Set chat action

You can set chat action (e.g. typing)

To set chat action, use ChatAction class-method

ChatAction class-method takes argument: action type you want to set (e.g. typing, upload_photo, or other)

app.controller.ts
import { Controller, OnCommand, ChatAction, GetAnswer, Answer } from 'nestgram';
import { AppService } from './app.service';

@Controller()
export class AppController {
  constructor(private readonly appService: AppService) {}

  @OnCommand('start')
  getChatAction(@GetAnswer() answer: Answer): ChatAction {
    setTimeout(() => answer.send('Hello, world!'), 2000);
    return new ChatAction('typing');
  }
}

Last updated