Get chat info, leave chat

You can get chat info: chat member count, chat info, chat admins, chat member and other

Get chat info

To get chat info, use .getChat answer/api method

.getChat answer/api method takes argument: chat id you want to get (optional in answer method, current chat id by default)

If you want to know what arguments an API method takes, see the IDE hint

Returns IChat on success

Get chat admins

To get chat administrators, use .getChatAdmins answer/api method

.getChatAdmins answer/api method takes argument: chat id you want to get admins to (optional in answer method, current chat id by default)

If you want to know what arguments an API method takes, see the IDE hint

Returns array of ChatMember on success

Get chat member count

To get chat member count, use .getChatMemberCount answer/api method

.getChatMemberCount answer/api method takes argument: chat id you want to get member count to (optional in answer method, current chat id by default)

If you want to know what arguments an API method takes, see the IDE hint

Returns number on success

Get chat member

To get chat member, use .getChatMember answer/api method

.getChatMember answer method take arguments:

You can read more about subscription checking here

If you want to know what arguments an API method takes, see the IDE hint

Returns ChatMember on success

Leave chat

You can leave chat using Leave class-method or .leave answer/api method

Leave class-method or .leave answer/api method takes argument: chat id you want to leave to as argument (optional in answer method, current chat id by default)

If you want to know what arguments an API method takes, see the IDE hint

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

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

  @OnCommand('leave')
  leaveChat() {
    return new Leave();
  }
}

Last updated