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