# Restrict or Promote user

## Restrict chat member

To restrict chat member, use **Restrict class-methods** or `.restrict` **answer/api method**

#### Restrict class-method or .restrict answer method take arguments:

<table><thead><tr><th data-type="number">Argument</th><th width="343.3333333333333">Description</th><th>Required</th></tr></thead><tbody><tr><td>1</td><td><a href="https://core.telegram.org/bots/api#chatpermissions">Permissions</a> you want to set</td><td><strong>Required</strong></td></tr><tr><td>2</td><td>User id you want to restrict</td><td>Optional. Current user id by default</td></tr><tr><td>3</td><td>Chat id in which user you want to restrict is located</td><td>Optional. Current chat id by default</td></tr><tr><td>4</td><td>Until date (unix date)</td><td>Optional</td></tr></tbody></table>

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

`NestgramDefault.chatPermissions` is chat permissions by default
{% endhint %}

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

```typescript
import { Controller, OnText, Restrict } from 'nestgram';
import { AppService } from './app.service';

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

  @OnText('restrict me')
  restrict() {
    return new Restrict({
      ...NestgramDefault.chatPermissions,
      can_send_messages: true,
      can_send_polls: false,
    }).next(`You're restricted!`);
  }
}
```

{% endcode %}

## Promote chat member

To promote chat member, use **Promote class-method** or `.promote` **answer/api method**. It takes [permissions](https://core.telegram.org/bots/api#promotechatmember) as 1st argument, and user id you want to restrict in the current chat (optional) as 2nd argument

#### Promote class-method or .promote answer method take arguments:

<table><thead><tr><th data-type="number">Argument</th><th width="287.89962825278815">Description</th><th>Required</th></tr></thead><tbody><tr><td>1</td><td><a href="https://core.telegram.org/bots/api#promotechatmember">Permissions</a></td><td><strong>Required</strong></td></tr><tr><td>2</td><td>User id you want to promote</td><td>Optional. Current user id by default</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, OnText, Promote } from 'nestgram';
import { AppService } from './app.service';

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

  @OnText('promote me')
  promote() {
    return new Promote({
      can_delete_messages: false,
    }).next(`You're promoted!`);
  }
}
```

{% 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/restrict-or-promote-user.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.
