Set chat permissions

You can set chat permissions (permissions for all users by default)

To set chat permissions, you can use ChatPermissions class-method or .setChatPermissions answer/api method

ChatPermissions class-method or .setChatPermissions takes argument: permissions you want to set

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

NestgramDefault.chatPermissions is chat permissions by default

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

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

  @OnCommand('admin_chat_permissions')
  updateChatPermissions(): ChatPermissions {
    return new ChatPermissions({
      ...NestgramDefault.chatPermissions,
      can_send_polls: false,
      can_invite_users: false,
    }).next('Chat permissions updated!');
  }
}

Last updated