feat(watcher,api,frontend): watched bots become accounts and drain the update backlog
This commit is contained in:
1 parent
4bd031f21e
commit
b0ed041c2e
21 files changed
+414
-1155
No files matched your search
@@ -4,8 +4,6 @@ import type {
|
||||
Alert,
|
||||
Annotation,
|
||||
AvatarHistoryView,
|
||||
BotStats,
|
||||
BotUpdate,
|
||||
CallbackView,
|
||||
CaptureToggles,
|
||||
Chat,
|
||||
@@ -583,20 +581,3 @@ export function addWatchedBot(token: string): Promise<WatchedBot> {
|
||||
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,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -18,6 +18,7 @@ export interface Account {
|
||||
account_id: number;
|
||||
device_model: string | null;
|
||||
is_active: boolean;
|
||||
is_bot: boolean;
|
||||
label: string | null;
|
||||
phone: string | null;
|
||||
tg_user_id: number | null;
|
||||
@@ -548,80 +549,14 @@ export interface ShareSubject {
|
||||
}
|
||||
|
||||
export interface WatchedBot {
|
||||
account_id: number | null;
|
||||
added_at: string;
|
||||
backfilled_at: string | null;
|
||||
bot_id: number;
|
||||
checked_at: string | null;
|
||||
enabled: boolean;
|
||||
incoming: number;
|
||||
last_ts: string | null;
|
||||
senders: number;
|
||||
status: string;
|
||||
status_detail: string | null;
|
||||
title: string | null;
|
||||
username: string | null;
|
||||
}
|
||||
|
||||
export interface BotSummary {
|
||||
chats: number;
|
||||
first_ts: string | null;
|
||||
incoming: number;
|
||||
last_ts: string | null;
|
||||
outgoing: number;
|
||||
senders: number;
|
||||
}
|
||||
|
||||
export interface BotSender {
|
||||
chat_id: number | null;
|
||||
first_ts: string;
|
||||
incoming: number;
|
||||
is_bot: boolean | null;
|
||||
last_ts: string;
|
||||
name: string | null;
|
||||
sender_id: number;
|
||||
username: string | null;
|
||||
}
|
||||
|
||||
export interface BotBucket {
|
||||
bucket: string;
|
||||
incoming: number;
|
||||
senders: number;
|
||||
}
|
||||
|
||||
export interface BotCount {
|
||||
incoming: number;
|
||||
key: string;
|
||||
}
|
||||
|
||||
export interface BotHour {
|
||||
hour: number;
|
||||
incoming: number;
|
||||
}
|
||||
|
||||
export interface BotStats {
|
||||
bot: WatchedBot;
|
||||
hours: BotHour[];
|
||||
kinds: BotCount[];
|
||||
media: BotCount[];
|
||||
senders: BotSender[];
|
||||
summary: BotSummary;
|
||||
timeline: BotBucket[];
|
||||
}
|
||||
|
||||
export interface BotUpdate {
|
||||
chat_id: number;
|
||||
chat_title: string | null;
|
||||
chat_type: string | null;
|
||||
edited_at: string | null;
|
||||
item_id: number;
|
||||
kind: string;
|
||||
media_kind: string | null;
|
||||
outgoing: boolean;
|
||||
sender_id: number | null;
|
||||
sender_is_bot: boolean | null;
|
||||
sender_name: string | null;
|
||||
sender_username: string | null;
|
||||
source: string;
|
||||
text: string | null;
|
||||
ts: string;
|
||||
}
|
||||
Reference in new issue
Block a user