feat(watcher,api,frontend): archive who writes to watched bots over mtproto
This commit is contained in:
1 parent
089a31db8d
commit
4bd031f21e
30 files changed
+1863
-10
No files matched your search
@@ -4,6 +4,8 @@ import type {
|
||||
Alert,
|
||||
Annotation,
|
||||
AvatarHistoryView,
|
||||
BotStats,
|
||||
BotUpdate,
|
||||
CallbackView,
|
||||
CaptureToggles,
|
||||
Chat,
|
||||
@@ -34,6 +36,7 @@ import type {
|
||||
StoryView,
|
||||
VolumeBucket,
|
||||
Watch,
|
||||
WatchedBot,
|
||||
} from "$lib/api/types";
|
||||
import { accounts } from "$lib/stores/accounts.svelte";
|
||||
|
||||
@@ -568,3 +571,32 @@ export function updateAnnotation(
|
||||
export function deleteAnnotation(id: number): Promise<void> {
|
||||
return request<void>(`/annotations/${id}`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
export function listWatchedBots(): Promise<WatchedBot[]> {
|
||||
return request<WatchedBot[]>("/bots");
|
||||
}
|
||||
|
||||
export function addWatchedBot(token: string): Promise<WatchedBot> {
|
||||
return request<WatchedBot>("/bots", { method: "POST", body: { token } });
|
||||
}
|
||||
|
||||
export function removeWatchedBot(botId: number): Promise<void> {
|
||||
return request<void>(`/bots/${botId}`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
export function botStats(botId: number, days = 90): Promise<BotStats> {
|
||||
return request<BotStats>(`/bots/${botId}/stats`, { query: { days } });
|
||||
}
|
||||
|
||||
export function botUpdates(
|
||||
botId: number,
|
||||
options: { limit?: number; offset?: number; senderId?: number } = {}
|
||||
): Promise<BotUpdate[]> {
|
||||
return request<BotUpdate[]>(`/bots/${botId}/updates`, {
|
||||
query: {
|
||||
limit: options.limit,
|
||||
offset: options.offset,
|
||||
sender_id: options.senderId,
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user