My default admin rights

You can set/get my default administrator rights

Set my default admin rights

You can set default admin rights using MyDefaultAdminRights class-method or .setMyDefaultAdminRights answer/api method

MyDefaultAdminRights class-method or .setMyDefaultAdminRights method take arguments:

ArgumentDescriptionRequired
1

Rights you want to set

Optional

2

For channel option

Optional. Pass true to get default admin rights of the bot in channels. Otherwise, default admin rights of the bot for groups and supergroups will be changed

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

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

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

  @OnCommand('start')
  setDefaultRights() {
    return new MyDefaultAdminRights({
      can_pin_messages: true,
    }).next('My default admin rights updated!');
  }
}

Get my default admin rights

To get the menu button, use .getMyDefaultAdminRights answer/api method

.getMyDefaultAdminRights answer method takes argument: for channel option (optional). Pass true to get default admin rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned

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

Returns IChatAdministratorRights on success

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

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

  @OnCommand('start')
  async getDefaultRights(@GetAnswer() answer: Answer) {
    console.log(await answer.getMyDefaultAdminRights());
    return 'Logged to console!';
  }
}

Last updated