> For the complete documentation index, see [llms.txt](https://degreetpro.gitbook.io/nestgram/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://degreetpro.gitbook.io/nestgram/api-reference/get-chat-info-leave-chat.md).

# Get chat info, leave chat

## Get chat info

To get chat info, use `.getChat` **answer/api method**

{% hint style="info" %}
.getChat answer/api method takes argument: chat id you want to get (optional in answer method, current chat id by default)

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

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

## Get chat admins

To get chat administrators, use `.getChatAdmins` **answer/api method**

{% hint style="info" %}
.getChatAdmins answer/api method takes argument: chat id you want to get admins to (optional in answer method, current chat id by default)

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

{% hint style="success" %}
Returns **array of** [ChatMember](https://core.telegram.org/bots/api#chatmember) on success
{% endhint %}

## Get chat member count

To get chat member count, use `.getChatMemberCount` **answer/api method**

{% hint style="info" %}
.getChatMemberCount answer/api method takes argument: chat id you want to get member count to (optional in answer method, current chat id by default)

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

{% hint style="success" %}
Returns **number** on success
{% endhint %}

## Get chat member

To get chat member, use `.getChatMember` **answer/api method**

#### .getChatMember answer method take arguments:

<table><thead><tr><th width="164.33333333333331" data-type="number">Argument</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>1</td><td>User id you want to get</td><td>Optional. Current user id by default</td></tr><tr><td>2</td><td>Chat id you want to get member to</td><td>Optional. Current chat id by default</td></tr></tbody></table>

{% hint style="info" %}
You can read more about subscription checking [here](/nestgram/api-reference/check-user-subscription.md)

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

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

## Leave chat

You can leave chat using **Leave class-method** or `.leave` **answer/api method**

{% hint style="info" %}
Leave class-method or .leave answer/api method takes argument: chat id you want to leave to as argument (optional in answer method, current chat id by default)

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

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

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

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

  @OnCommand('leave')
  leaveChat() {
    return new Leave();
  }
}
```

{% endcode %}
