Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@adiwajshing/baileys/lib/LegacySocket/chats.d.ts
1129 views
1
/// <reference types="node" />
2
/// <reference types="ws" />
3
import { Chat, ChatModification, LegacySocketConfig, WABusinessProfile, WAMessageKey, WAPresence } from '../Types';
4
import { BinaryNode } from '../WABinary';
5
declare const makeChatsSocket: (config: LegacySocketConfig) => {
6
sendChatsQuery: (epoch: number) => Promise<string>;
7
profilePictureUrl: (jid: string, timeoutMs?: number) => Promise<string | undefined>;
8
chatRead: (fromMessage: WAMessageKey, count: number) => Promise<void>;
9
/**
10
* Modify a given chat (archive, pin etc.)
11
* @param jid the ID of the person/group you are modifiying
12
*/
13
chatModify: (modification: ChatModification, jid: string, chatInfo: Pick<Chat, 'mute' | 'pin'>, timestampNow?: number) => Promise<void | {
14
status: number;
15
}>;
16
/**
17
* Query whether a given number is registered on WhatsApp
18
* @param str phone number/jid you want to check for
19
* @returns undefined if the number doesn't exists, otherwise the correctly formatted jid
20
*/
21
onWhatsApp: (str: string) => Promise<{
22
exists: boolean;
23
jid: string;
24
isBusiness: boolean;
25
} | undefined>;
26
/**
27
* Tell someone about your presence -- online, typing, offline etc.
28
* @param jid the ID of the person/group who you are updating
29
* @param type your presence
30
*/
31
sendPresenceUpdate: (type: WAPresence, toJid?: string) => Promise<string>;
32
/**
33
* Request updates on the presence of a user
34
* this returns nothing, you'll receive updates in chats.update event
35
* */
36
presenceSubscribe: (jid: string) => Promise<string>;
37
/** Query the status of the person (see groupMetadata() for groups) */
38
getStatus: (jid: string) => Promise<{
39
status: string;
40
}>;
41
setStatus: (status: string) => Promise<{
42
status: number;
43
}>;
44
/** Updates business profile. */
45
updateBusinessProfile: (profile: WABusinessProfile) => Promise<void>;
46
updateProfileName: (name: string) => Promise<{
47
status: number;
48
pushname: string;
49
}>;
50
/**
51
* Update the profile picture
52
* @param jid
53
* @param img
54
*/
55
updateProfilePicture(jid: string, imgBuffer: Buffer): Promise<void>;
56
/**
57
* Add or remove user from blocklist
58
* @param jid the ID of the person who you are blocking/unblocking
59
* @param type type of operation
60
*/
61
blockUser: (jid: string, type?: 'add' | 'remove') => Promise<void>;
62
/**
63
* Query Business Profile (Useful for VCards)
64
* @param jid Business Jid
65
* @returns profile object or undefined if not business account
66
*/
67
getBusinessProfile: (jid: string) => Promise<WABusinessProfile>;
68
state: import("../Types").ConnectionState;
69
authInfo: import("../Types").LegacyAuthenticationCreds;
70
ev: import("../Types").LegacyBaileysEventEmitter;
71
canLogin: () => boolean;
72
logout: () => Promise<void>;
73
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
74
type: "legacy";
75
ws: import("ws");
76
sendAdminTest: () => Promise<string>;
77
updateKeys: (info: {
78
encKey: Buffer;
79
macKey: Buffer;
80
}) => {
81
encKey: Buffer;
82
macKey: Buffer;
83
};
84
waitForSocketOpen: () => Promise<void>;
85
sendNode: ({ json, binaryTag, tag, longTag }: import("../Types").SocketSendMessageOptions) => Promise<string>;
86
generateMessageTag: (longTag?: boolean) => string;
87
waitForMessage: (tag: string, requiresPhoneConnection: boolean, timeoutMs?: number | undefined) => {
88
promise: Promise<any>;
89
cancelToken: () => void;
90
};
91
query: ({ json, timeoutMs, expect200, tag, longTag, binaryTag, requiresPhoneConnection }: import("../Types").SocketQueryOptions) => Promise<any>;
92
setQuery: (nodes: BinaryNode[], binaryTag?: import("../Types").WATag, tag?: string | undefined) => Promise<{
93
status: number;
94
}>;
95
currentEpoch: () => number;
96
end: (error: Error | undefined) => void;
97
};
98
export default makeChatsSocket;
99
100