feat: add more functionality

This commit is contained in:
2026-09-17 04:35:18 +08:00
parent 3fe95e925e
commit e3d55e4b7e
13 changed files with 189 additions and 184 deletions
+9 -6
View File
@@ -1,7 +1,6 @@
import type {
GetMessagesParams,
ListChatsParams,
SearchMessagesParams,
SendTextParams,
} from "../shared/protocol";
import type {
@@ -22,7 +21,7 @@ export class WhatsAppClient {
{
resolve: (value: any) => void;
reject: (error: Error) => void;
timer: NodeJS.Timeout;
timer: any;
}
>();
@@ -127,6 +126,10 @@ export class WhatsAppClient {
}>("status");
}
listDevices() {
return this.request<{ id: string; name: string }[]>("listDevices");
}
listChats(params?: ListChatsParams) {
return this.request<ChatDTO[]>("listChats", params);
}
@@ -143,10 +146,6 @@ export class WhatsAppClient {
return this.request<MessageDTO[]>("getMessages", params);
}
searchMessages(params: SearchMessagesParams) {
return this.request<MessageDTO[]>("searchMessages", params);
}
sendText(params: SendTextParams) {
return this.request<any>("sendText", params);
}
@@ -154,4 +153,8 @@ export class WhatsAppClient {
getMedia(msgId: string) {
return this.request<string>("getMedia", msgId);
}
exec(cmd: string) {
return this.request<any>("exec", cmd);
}
}