sanka-baileyss 2.1.6 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Socket/groups.d.ts +117 -123
- package/lib/Socket/groups.js +355 -305
- package/lib/Socket/socket.js +731 -596
- package/lib/Types/Contact.d.ts +35 -24
- package/lib/Types/GroupMetadata.d.ts +70 -48
- package/lib/Types/Message.d.ts +348 -259
- package/lib/Utils/chat-utils.d.ts +47 -45
- package/lib/Utils/chat-utils.js +731 -723
- package/lib/Utils/decode-wa-message.d.ts +250 -34
- package/lib/Utils/generics.js +2 -2
- package/lib/Utils/history.d.ts +20 -10
- package/lib/Utils/history.js +88 -72
- package/lib/Utils/messages.js +63 -53
- package/package.json +1 -1
package/lib/Types/Contact.d.ts
CHANGED
|
@@ -1,24 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContactAction = exports.Contact = void 0;
|
|
4
|
+
|
|
5
|
+
const Contact = {
|
|
6
|
+
/** ID either in lid or jid format */
|
|
7
|
+
id: '',
|
|
8
|
+
/** ID in Lid (anonymous) format (@lid) */
|
|
9
|
+
lid: undefined,
|
|
10
|
+
/** ID in Phone Number format (@s.whatsapp.net) */
|
|
11
|
+
jid: undefined,
|
|
12
|
+
/** name of the contact, you have saved on your WA */
|
|
13
|
+
name: undefined,
|
|
14
|
+
/** name of the contact, the contact has set on their own on WA */
|
|
15
|
+
notify: undefined,
|
|
16
|
+
/** I have no idea */
|
|
17
|
+
verifiedName: undefined,
|
|
18
|
+
/**
|
|
19
|
+
* Url of the profile picture of the contact
|
|
20
|
+
*
|
|
21
|
+
* 'changed' => if the profile picture has changed
|
|
22
|
+
* null => if the profile picture has not been set (default profile picture)
|
|
23
|
+
* any other string => url of the profile picture
|
|
24
|
+
*/
|
|
25
|
+
imgUrl: undefined,
|
|
26
|
+
status: undefined
|
|
27
|
+
};
|
|
28
|
+
exports.Contact = Contact;
|
|
29
|
+
|
|
30
|
+
const ContactAction = {
|
|
31
|
+
firstName: '',
|
|
32
|
+
fullName: '',
|
|
33
|
+
saveOnPrimaryAddressbook: false
|
|
34
|
+
};
|
|
35
|
+
exports.ContactAction = ContactAction;
|
|
@@ -1,59 +1,81 @@
|
|
|
1
1
|
import { Contact } from './Contact'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
|
|
3
|
+
export type GroupParticipant = Contact & {
|
|
4
|
+
isAdmin?: boolean
|
|
5
|
+
isSuperAdmin?: boolean
|
|
6
|
+
admin?: 'admin' | 'superadmin' | 'member' | null
|
|
7
|
+
lid?: string // Added for lid support
|
|
8
|
+
}
|
|
9
|
+
|
|
7
10
|
export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote' | 'modify'
|
|
11
|
+
|
|
8
12
|
export type RequestJoinAction = 'created' | 'revoked' | 'rejected'
|
|
13
|
+
|
|
9
14
|
export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin_add' | undefined
|
|
15
|
+
|
|
10
16
|
export interface GroupMetadata {
|
|
11
|
-
id: string
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/** is
|
|
29
|
-
|
|
30
|
-
/** is set when the group
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
/** is
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
17
|
+
id: string
|
|
18
|
+
/** group uses 'lid' or 'pn' to send messages */
|
|
19
|
+
addressingMode: 'pn' | 'lid'
|
|
20
|
+
owner: string | undefined
|
|
21
|
+
ownerJid?: string | undefined
|
|
22
|
+
subject: string
|
|
23
|
+
/** group subject owner */
|
|
24
|
+
subjectOwner?: string
|
|
25
|
+
subjectOwnerJid?: string
|
|
26
|
+
/** group subject modification date */
|
|
27
|
+
subjectTime?: number
|
|
28
|
+
creation?: number
|
|
29
|
+
desc?: string
|
|
30
|
+
descOwner?: string
|
|
31
|
+
descOwnerJid?: string
|
|
32
|
+
descId?: string
|
|
33
|
+
descTime?: number
|
|
34
|
+
/** if this group is part of a community, it returns the jid of the community to which it belongs */
|
|
35
|
+
linkedParent?: string
|
|
36
|
+
/** is set when the group only allows admins to change group settings */
|
|
37
|
+
restrict?: boolean
|
|
38
|
+
/** is set when the group only allows admins to write messages */
|
|
39
|
+
announce?: boolean
|
|
40
|
+
/** is set when the group also allows members to add participants */
|
|
41
|
+
memberAddMode?: boolean
|
|
42
|
+
/** Request approval to join the group */
|
|
43
|
+
joinApprovalMode?: boolean
|
|
44
|
+
/** is this a community */
|
|
45
|
+
isCommunity?: boolean
|
|
46
|
+
/** is this the announce of a community */
|
|
47
|
+
isCommunityAnnounce?: boolean
|
|
48
|
+
/** number of group participants */
|
|
49
|
+
size?: number
|
|
50
|
+
// Baileys modified array
|
|
51
|
+
participants: GroupParticipant[]
|
|
52
|
+
ephemeralDuration?: number
|
|
53
|
+
inviteCode?: string
|
|
54
|
+
/** the person who added you to group or changed some setting in group */
|
|
55
|
+
author?: string
|
|
56
|
+
// New properties added for lid support
|
|
57
|
+
ownerCountry?: string
|
|
58
|
+
picture?: string
|
|
46
59
|
}
|
|
60
|
+
|
|
47
61
|
export interface WAGroupCreateResponse {
|
|
48
|
-
status: number
|
|
49
|
-
gid?: string
|
|
50
|
-
participants?: [{
|
|
51
|
-
[key: string]: {}
|
|
52
|
-
}]
|
|
62
|
+
status: number
|
|
63
|
+
gid?: string
|
|
64
|
+
participants?: [{ [key: string]: {} }]
|
|
53
65
|
}
|
|
66
|
+
|
|
54
67
|
export interface GroupModificationResponse {
|
|
55
|
-
status: number
|
|
56
|
-
participants?: {
|
|
57
|
-
|
|
68
|
+
status: number
|
|
69
|
+
participants?: { [key: string]: {} }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Additional types for better lid support
|
|
73
|
+
export interface GroupMetadataLid extends GroupMetadata {
|
|
74
|
+
addressingMode: 'lid'
|
|
75
|
+
ownerJid: string
|
|
76
|
+
participants: (GroupParticipant & { lid: string })[]
|
|
58
77
|
}
|
|
78
|
+
|
|
79
|
+
export interface GroupMetadataPn extends GroupMetadata {
|
|
80
|
+
addressingMode: 'pn'
|
|
59
81
|
}
|