From a53586f7985ea583ede2c930413dd8687745ac7f Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Fri, 11 Jun 2021 03:15:49 +0300 Subject: [PATCH] Bring back bots restricted on other platforms (#1141) --- src/api/gramjs/apiBuilders/chats.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/api/gramjs/apiBuilders/chats.ts b/src/api/gramjs/apiBuilders/chats.ts index c5c758e5d..6b74ec08a 100644 --- a/src/api/gramjs/apiBuilders/chats.ts +++ b/src/api/gramjs/apiBuilders/chats.ts @@ -109,9 +109,19 @@ function buildApiChatRestrictions(peerEntity: GramJs.TypeUser | GramJs.TypeChat) } if (peerEntity instanceof GramJs.User) { + const restrictionReason = peerEntity.restricted + ? buildApiChatRestrictionReason(peerEntity.restrictionReason) + : undefined; + + if (restrictionReason === undefined) { + return { + isRestricted: false, + }; + } + return { isRestricted: peerEntity.restricted, - restrictionReason: buildApiChatRestrictionReason(peerEntity.restrictionReason), + restrictionReason, }; } else if (peerEntity instanceof GramJs.Chat) { return {