Update members count from full chat info
This commit is contained in:
parent
897c2f69ef
commit
2b55037b08
@ -339,6 +339,7 @@ async function getFullChatInfo(chatId: string): Promise<{
|
|||||||
fullInfo: ApiChatFullInfo;
|
fullInfo: ApiChatFullInfo;
|
||||||
users?: ApiUser[];
|
users?: ApiUser[];
|
||||||
groupCall?: Partial<ApiGroupCall>;
|
groupCall?: Partial<ApiGroupCall>;
|
||||||
|
membersCount?: number;
|
||||||
} | undefined> {
|
} | undefined> {
|
||||||
const result = await invokeRequest(new GramJs.messages.GetFullChat({
|
const result = await invokeRequest(new GramJs.messages.GetFullChat({
|
||||||
chatId: buildInputEntity(chatId) as BigInt.BigInteger,
|
chatId: buildInputEntity(chatId) as BigInt.BigInteger,
|
||||||
@ -391,6 +392,7 @@ async function getFullChatInfo(chatId: string): Promise<{
|
|||||||
version: 0,
|
version: 0,
|
||||||
participants: {},
|
participants: {},
|
||||||
} : undefined,
|
} : undefined,
|
||||||
|
membersCount: members?.length,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,6 +404,7 @@ async function getFullChannelInfo(
|
|||||||
fullInfo: ApiChatFullInfo;
|
fullInfo: ApiChatFullInfo;
|
||||||
users?: ApiUser[];
|
users?: ApiUser[];
|
||||||
groupCall?: Partial<ApiGroupCall>;
|
groupCall?: Partial<ApiGroupCall>;
|
||||||
|
membersCount?: number;
|
||||||
} | undefined> {
|
} | undefined> {
|
||||||
const result = await invokeRequest(new GramJs.channels.GetFullChannel({
|
const result = await invokeRequest(new GramJs.channels.GetFullChannel({
|
||||||
channel: buildInputEntity(id, accessHash) as GramJs.InputChannel,
|
channel: buildInputEntity(id, accessHash) as GramJs.InputChannel,
|
||||||
@ -430,6 +433,7 @@ async function getFullChannelInfo(
|
|||||||
requestsPending,
|
requestsPending,
|
||||||
recentRequesters,
|
recentRequesters,
|
||||||
statsDc,
|
statsDc,
|
||||||
|
participantsCount,
|
||||||
} = result.fullChat;
|
} = result.fullChat;
|
||||||
|
|
||||||
const inviteLink = exportedInvite instanceof GramJs.ChatInviteExported
|
const inviteLink = exportedInvite instanceof GramJs.ChatInviteExported
|
||||||
@ -498,6 +502,7 @@ async function getFullChannelInfo(
|
|||||||
participantsCount: 0,
|
participantsCount: 0,
|
||||||
connectionState: 'disconnected',
|
connectionState: 'disconnected',
|
||||||
} : undefined,
|
} : undefined,
|
||||||
|
membersCount: participantsCount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1079,7 +1079,9 @@ export async function loadFullChat(chat: ApiChat) {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { users, fullInfo, groupCall } = result;
|
const {
|
||||||
|
users, fullInfo, groupCall, membersCount,
|
||||||
|
} = result;
|
||||||
|
|
||||||
let global = getGlobal();
|
let global = getGlobal();
|
||||||
if (users) {
|
if (users) {
|
||||||
@ -1097,7 +1099,10 @@ export async function loadFullChat(chat: ApiChat) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
global = updateChat(global, chat.id, { fullInfo });
|
global = updateChat(global, chat.id, {
|
||||||
|
fullInfo,
|
||||||
|
...(membersCount && { membersCount }),
|
||||||
|
});
|
||||||
|
|
||||||
setGlobal(global);
|
setGlobal(global);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user