# My default admin 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:

<table><thead><tr><th width="150" data-type="number">Argument</th><th width="233.8022759601707">Description</th><th width="353">Required</th></tr></thead><tbody><tr><td>1</td><td><a href="https://core.telegram.org/bots/api#chatadministratorrights">Rights</a> you want to set</td><td>Optional</td></tr><tr><td>2</td><td>For channel option</td><td>Optional. Pass <code>true</code> to get default admin rights of the bot in channels. Otherwise, default admin rights of the bot for groups and supergroups will be changed</td></tr></tbody></table>

{% hint style="info" %}
If you want to know what arguments an API method takes, see the IDE hint
{% endhint %}

{% code title="app.controller.ts" %}

```typescript
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!');
  }
}
```

{% endcode %}

## Get my default admin rights

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

{% hint style="info" %}
.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
{% endhint %}

{% hint style="success" %}
Returns [IChatAdministratorRights](https://core.telegram.org/bots/api#chatadministratorrights) on success
{% endhint %}

{% code title="app.controller.ts" %}

```typescript
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!';
  }
}
```

{% endcode %}
