From abbebeddf9ad139a8ed6a4816b4b18eba9cb4ba6 Mon Sep 17 00:00:00 2001 From: teidesu <86301490+teidesu@users.noreply.github.com> Date: Wed, 30 Jun 2021 02:01:11 +0300 Subject: [PATCH] feat(client): isGroup getter for Chat --- packages/client/src/types/peers/chat.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/client/src/types/peers/chat.ts b/packages/client/src/types/peers/chat.ts index 7f68cbed..9a9d40ba 100644 --- a/packages/client/src/types/peers/chat.ts +++ b/packages/client/src/types/peers/chat.ts @@ -156,6 +156,21 @@ export class Chat { return this._type! } + /** + * Whether this chat is a group chat + * (i.e. not a channel and not PM) + */ + get isGroup(): boolean { + switch (this.type) { + case 'group': + case 'supergroup': + case 'gigagroup': + return true + } + + return false + } + /** * Whether this chat has been verified by Telegram. * Supergroups, channels and groups only