# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://degreetpro.gitbook.io/nestgram/api-reference/my-default-admin-rights.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
