feat(api,userbot,frontend): search peers without chats and start tracking them
This commit is contained in:
1 parent
dcf95bd9d4
commit
92fd20137e
21 files changed
+936
-65
No files matched your search
@@ -9,6 +9,7 @@ import type {
|
||||
Chat,
|
||||
ChatLinkView,
|
||||
DayCount,
|
||||
DiscoverItem,
|
||||
Folder,
|
||||
JobStatus,
|
||||
JobView,
|
||||
@@ -301,6 +302,37 @@ export function enqueueBackfill(
|
||||
});
|
||||
}
|
||||
|
||||
export function discoverPeers(
|
||||
query: string,
|
||||
remote = false
|
||||
): Promise<DiscoverItem[]> {
|
||||
return request<DiscoverItem[]>("/discover", {
|
||||
account: true,
|
||||
query: { query, remote },
|
||||
});
|
||||
}
|
||||
|
||||
export function getDiscoverItem(chatId: number): Promise<DiscoverItem> {
|
||||
return request<DiscoverItem>(`/discover/${chatId}`, { account: true });
|
||||
}
|
||||
|
||||
export function trackChat(
|
||||
chatId: number,
|
||||
backfill = true
|
||||
): Promise<DiscoverItem> {
|
||||
return request<DiscoverItem>(`/chats/${chatId}/track`, {
|
||||
method: "POST",
|
||||
body: { account_id: accounts.selectedId, backfill },
|
||||
});
|
||||
}
|
||||
|
||||
export function syncContacts(): Promise<{ job_id: number }> {
|
||||
return request<{ job_id: number }>("/contacts/sync", {
|
||||
method: "POST",
|
||||
body: { account_id: accounts.selectedId },
|
||||
});
|
||||
}
|
||||
|
||||
export function syncDialogs(): Promise<{ job_id: number }> {
|
||||
return request<{ job_id: number }>("/dialogs/sync", {
|
||||
method: "POST",
|
||||
|
||||
@@ -36,6 +36,21 @@ export interface Chat {
|
||||
title: string | null;
|
||||
}
|
||||
|
||||
export type DiscoverKind = "private" | "group" | "channel";
|
||||
|
||||
export interface DiscoverItem {
|
||||
chat_id: number;
|
||||
has_avatar: boolean;
|
||||
in_dialogs: boolean;
|
||||
is_bot: boolean;
|
||||
is_contact: boolean;
|
||||
kind: DiscoverKind;
|
||||
message_count: number;
|
||||
title: string | null;
|
||||
tracked: boolean;
|
||||
username: string | null;
|
||||
}
|
||||
|
||||
export interface EntityView {
|
||||
custom_emoji_id: string | null;
|
||||
language: string | null;
|
||||
|
||||
Reference in new issue
Block a user