@itsliaaa/starcore 0.0.0-alpha.0 → 0.0.0-alpha.1
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/README.md +619 -20
- package/lib/Auth.js +1 -1
- package/lib/Client.js +1 -1
- package/lib/Constants.js +1 -1
- package/lib/Database.js +1 -1
- package/lib/Media.js +1 -1
- package/lib/Message.js +1 -1
- package/lib/Request.js +1 -1
- package/lib/Scraper.js +1 -1
- package/lib/Serialize.js +1 -1
- package/lib/Socket.js +1 -1
- package/lib/Store.js +1 -1
- package/lib/Utilities.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,15 +40,92 @@
|
|
|
40
40
|
|
|
41
41
|
Built with a focus on simplicity, and better compatibility with modern WhatsApp features.
|
|
42
42
|
|
|
43
|
-
###
|
|
43
|
+
### 📋 Table of Contents
|
|
44
|
+
|
|
45
|
+
- [📌 Highlights](#-highlights)
|
|
46
|
+
- [📥 Installations](#-installations)
|
|
47
|
+
- [📄 Via `package.json`](#-via-packagejson)
|
|
48
|
+
- [⌨️ Via terminal](#%EF%B8%8F-via-terminal)
|
|
49
|
+
- [🧩 Import (ESM & CJS)](#-import-esm--cjs)
|
|
50
|
+
- [📄 Quick Step](#-quick-step)
|
|
51
|
+
- [⚙️ Advanced Usage](#%EF%B8%8F-advanced-usage)
|
|
52
|
+
- [📡 Events Reference](#-events-reference)
|
|
53
|
+
- [👥 Find User ID](#-find-user-id)
|
|
54
|
+
- [📨 Sending Messages](#-sending-messages)
|
|
55
|
+
- [🔠 Text](#-text)
|
|
56
|
+
- [📰 Link Preview](#-link-preview)
|
|
57
|
+
- [😄 Reaction](#-reaction)
|
|
58
|
+
- [📂 Media](#-media)
|
|
59
|
+
- [⚪ PTV](#-ptv)
|
|
60
|
+
- [📃 Sticker](#-sticker)
|
|
61
|
+
- [📦 Sticker Pack](#-sticker-pack)
|
|
62
|
+
- [👤 Contact](#-contact)
|
|
63
|
+
- [🖼️ Album](#%EF%B8%8F-album)
|
|
64
|
+
- [🗄️ Interactive](#%EF%B8%8F-interactive)
|
|
65
|
+
- [🎠 Carousel](#-carousel)
|
|
66
|
+
- [🔘 Legacy Button](#-legacy-button)
|
|
67
|
+
- [📋 Legacy List](#-legacy-list)
|
|
68
|
+
- [📊 Poll](#-poll)
|
|
69
|
+
- [📈 Poll Result](#-poll-result)
|
|
70
|
+
- [✨ Rich](#-rich)
|
|
71
|
+
- [🗒️ Copy & Forward](#%EF%B8%8F-copy--forward)
|
|
72
|
+
- [🎞️ Status Mention](#%EF%B8%8F-status-mention)
|
|
73
|
+
- [👥 Group Status](#-group-status)
|
|
74
|
+
- [♻️ Modify Messages](#%EF%B8%8F-modify-messages)
|
|
75
|
+
- [🗑️ Delete Messages](#%EF%B8%8F-delete-messages)
|
|
76
|
+
- [✏️ Edit Messages](#%EF%B8%8F-edit-messages)
|
|
77
|
+
- [⚙️ Baileys Features](#%EF%B8%8F-baileys-features)
|
|
78
|
+
- [🔑 Request Custom Pairing Code](#-request-custom-pairing-code)
|
|
79
|
+
- [📣 Newsletter Management](#-newsletter-management)
|
|
80
|
+
- [👥 Group Management](#-group-management)
|
|
81
|
+
- [👥 Community Management](#-community-management)
|
|
82
|
+
- [👤 Profile Management](#-profile-management)
|
|
83
|
+
- [🛒 Business Management](#-business-management)
|
|
84
|
+
- [🔐 Privacy Management](#-privacy-management)
|
|
85
|
+
- [📡 Baileys Events Reference](#-baileys-events-reference)
|
|
86
|
+
- [🗳️ Database](#%EF%B8%8F-database)
|
|
87
|
+
- [🌐 Request](#-request)
|
|
88
|
+
- [📚 Exported Modules](#-exported-modules)
|
|
89
|
+
- [🚀 Try the Bot](#-try-the-bot)
|
|
90
|
+
- [📣 Credits](#-credits)
|
|
91
|
+
|
|
92
|
+
### 📥 Installations
|
|
93
|
+
|
|
94
|
+
#### 📄 Via `package.json`
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
# NPM
|
|
98
|
+
"dependencies": {
|
|
99
|
+
"@itsliaaa/starcore": "latest"
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
# GitHub
|
|
103
|
+
"dependencies": {
|
|
104
|
+
"@itsliaaa/starcore": "github:itsliaaa/starcore"
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### ⌨️ Via terminal
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# NPM
|
|
112
|
+
npm i @itsliaaa/starcore@latest
|
|
113
|
+
|
|
114
|
+
# GitHub
|
|
115
|
+
npm i github:itsliaaa/starcore
|
|
116
|
+
```
|
|
44
117
|
|
|
45
|
-
|
|
118
|
+
#### 🧩 Import (ESM & CJS)
|
|
46
119
|
|
|
47
|
-
|
|
120
|
+
```javascript
|
|
121
|
+
// --- ESM
|
|
122
|
+
import { Client } from '@itsliaaa/starcore'
|
|
48
123
|
|
|
49
|
-
|
|
124
|
+
// --- CJS (tested and working on Node.js 24 ✅)
|
|
125
|
+
const { Client } = require('@itsliaaa/starcore')
|
|
126
|
+
```
|
|
50
127
|
|
|
51
|
-
### 📄
|
|
128
|
+
### 📄 Quick Step
|
|
52
129
|
|
|
53
130
|
```javascript
|
|
54
131
|
import { Client } from '@itsliaaa/starcore'
|
|
@@ -90,11 +167,10 @@ const client = new Client({
|
|
|
90
167
|
},
|
|
91
168
|
isBotMessageId: (id) =>
|
|
92
169
|
typeof id === 'string' && id.includes('3EB0'),
|
|
93
|
-
messageIdPrefix: '
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
autoFollowNewsletter: '1111122222@newsletter', // String | String[] | false
|
|
170
|
+
messageIdPrefix: 'STARCORE',
|
|
171
|
+
updatePresence: true, // Default: true
|
|
172
|
+
updateProtoOnStartup: true, // Default: true
|
|
173
|
+
autoFollowNewsletter: '1211111111111@newsletter', // String | String[] | false
|
|
98
174
|
newsletterAnnotation: {
|
|
99
175
|
newsletterJid: '',
|
|
100
176
|
newsletterName: ''
|
|
@@ -112,7 +188,7 @@ const client = new Client({
|
|
|
112
188
|
### 📡 Events Reference
|
|
113
189
|
|
|
114
190
|
```javascript
|
|
115
|
-
client.
|
|
191
|
+
client.on('ready', console.log)
|
|
116
192
|
client.on('message', console.log)
|
|
117
193
|
client.on('message.edit', console.log)
|
|
118
194
|
client.on('message.delete', console.log)
|
|
@@ -133,19 +209,19 @@ Quickly resolve a user's `JID` and retrieve both `PN` and `LID` in a synchronous
|
|
|
133
209
|
|
|
134
210
|
```javascript
|
|
135
211
|
// Accepts either @s.whatsapp.net or @lid
|
|
136
|
-
const jidLid = '
|
|
212
|
+
const jidLid = '6281111111111@s.whatsapp.net'
|
|
137
213
|
|
|
138
214
|
const result = sock.findUserId(jidLid)
|
|
139
215
|
|
|
140
216
|
// --- Success
|
|
141
217
|
// {
|
|
142
|
-
// phoneNumber: '
|
|
143
|
-
// lid: '
|
|
218
|
+
// phoneNumber: '6281111111111@s.whatsapp.net',
|
|
219
|
+
// lid: '1211111111111@lid'
|
|
144
220
|
// }
|
|
145
221
|
|
|
146
222
|
// --- Not found
|
|
147
223
|
// {
|
|
148
|
-
// phoneNumber: '
|
|
224
|
+
// phoneNumber: '6281111111111@s.whatsapp.net',
|
|
149
225
|
// lid: undefined // or null
|
|
150
226
|
// }
|
|
151
227
|
```
|
|
@@ -157,7 +233,7 @@ const result = sock.findUserId(jidLid)
|
|
|
157
233
|
```javascript
|
|
158
234
|
sock.sendText(jid, '👋🏻 Hello', message, {
|
|
159
235
|
mentionAll: false, // Optional
|
|
160
|
-
mentions: ['
|
|
236
|
+
mentions: ['1211111111111@lid', '6281111111111@s.whatsapp.net'], // Optional
|
|
161
237
|
})
|
|
162
238
|
```
|
|
163
239
|
|
|
@@ -243,7 +319,7 @@ sock.sendContact(jid, [{
|
|
|
243
319
|
website: 'https://www.npmjs.com/package/@itsliaaa/starcore#readme',
|
|
244
320
|
location: 'Jakarta',
|
|
245
321
|
other: '❤️ Simplified WhatsApp API',
|
|
246
|
-
number: '
|
|
322
|
+
number: '6281111111111'
|
|
247
323
|
}, {
|
|
248
324
|
name: '❤️ My Big Brother',
|
|
249
325
|
org: '👥 Siblings',
|
|
@@ -251,7 +327,7 @@ sock.sendContact(jid, [{
|
|
|
251
327
|
website: 'https://www.npmjs.com/package/@itsliaaa/starcore#readme',
|
|
252
328
|
location: 'Jakarta',
|
|
253
329
|
other: '❤️ Simplified WhatsApp API',
|
|
254
|
-
number: '
|
|
330
|
+
number: '6281111111111'
|
|
255
331
|
}], message)
|
|
256
332
|
```
|
|
257
333
|
|
|
@@ -276,7 +352,7 @@ sock.sendInteractive(jid, [{
|
|
|
276
352
|
icon: 'review' // Optional
|
|
277
353
|
}, {
|
|
278
354
|
text: '📞 Call',
|
|
279
|
-
call: '
|
|
355
|
+
call: '6281111111111'
|
|
280
356
|
}, {
|
|
281
357
|
text: '📋 Copy',
|
|
282
358
|
copy: '@itsliaaa/starcore'
|
|
@@ -672,6 +748,529 @@ sock.sendGroupStatus(jid, {
|
|
|
672
748
|
})
|
|
673
749
|
```
|
|
674
750
|
|
|
751
|
+
### ♻️ Modify Messages
|
|
752
|
+
|
|
753
|
+
#### 🗑️ Delete Messages
|
|
754
|
+
|
|
755
|
+
```javascript
|
|
756
|
+
sock.sendMessage(jid, {
|
|
757
|
+
delete: message.key
|
|
758
|
+
})
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
#### ✏️ Edit Messages
|
|
762
|
+
|
|
763
|
+
```javascript
|
|
764
|
+
// --- Edit plain text
|
|
765
|
+
sock.sendMessage(jid, {
|
|
766
|
+
text: '✨ I mean, nice!',
|
|
767
|
+
edit: message.key
|
|
768
|
+
})
|
|
769
|
+
|
|
770
|
+
// --- Edit media messages caption
|
|
771
|
+
sock.sendMessage(jid, {
|
|
772
|
+
caption: '✨ I mean, here is the image!',
|
|
773
|
+
edit: message.key
|
|
774
|
+
})
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
### ⚙️ Baileys Features
|
|
778
|
+
|
|
779
|
+
#### 🔑 Request Custom Pairing Code
|
|
780
|
+
|
|
781
|
+
> [!NOTE]
|
|
782
|
+
> The phone number must contain numbers only (no +, (), or -) and must include the country code.
|
|
783
|
+
|
|
784
|
+
```javascript
|
|
785
|
+
const phoneNumber = '6281111111111'
|
|
786
|
+
const customPairingCode = 'STARCORE'
|
|
787
|
+
|
|
788
|
+
await sock.requestPairingCode(phoneNumber, customPairingCode)
|
|
789
|
+
|
|
790
|
+
console.log('🔗 Pairing code', ':', customPairingCode)
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
#### 📣 Newsletter Management
|
|
794
|
+
|
|
795
|
+
```javascript
|
|
796
|
+
// --- Create a new one
|
|
797
|
+
sock.newsletterCreate('@itsliaaa/starcore', '📣 Fresh updates weekly')
|
|
798
|
+
|
|
799
|
+
// --- Get info
|
|
800
|
+
const metadata = sock.newsletterMetadata('1211111111111@newsletter')
|
|
801
|
+
console.dir(metadata, { depth: null })
|
|
802
|
+
|
|
803
|
+
// --- Get subscribers count
|
|
804
|
+
const subscribers = await sock.newsletterSubscribers('1211111111111@newsletter')
|
|
805
|
+
console.dir(subscribers, { depth: null })
|
|
806
|
+
|
|
807
|
+
// --- Follow and Unfollow
|
|
808
|
+
sock.newsletterFollow('1211111111111@newsletter')
|
|
809
|
+
sock.newsletterUnfollow('1211111111111@newsletter')
|
|
810
|
+
|
|
811
|
+
// --- Mute and Unmute
|
|
812
|
+
sock.newsletterMute('1211111111111@newsletter')
|
|
813
|
+
sock.newsletterUnmute('1211111111111@newsletter')
|
|
814
|
+
|
|
815
|
+
// --- Demote admin
|
|
816
|
+
sock.newsletterDemote('1211111111111@newsletter', '6281111111111@s.whatsapp.net')
|
|
817
|
+
|
|
818
|
+
// --- Change owner
|
|
819
|
+
sock.newsletterChangeOwner('1211111111111@newsletter', '6281111111111@s.whatsapp.net')
|
|
820
|
+
|
|
821
|
+
// --- Update newsletter
|
|
822
|
+
sock.newsletterUpdate('1211111111111@newsletter', { name: '@itsliaaa/starcore' })
|
|
823
|
+
|
|
824
|
+
// --- Change name
|
|
825
|
+
sock.newsletterUpdateName('1211111111111@newsletter', '✨ @itsliaaa/starcore')
|
|
826
|
+
|
|
827
|
+
// --- Change description
|
|
828
|
+
sock.newsletterUpdateDescription('1211111111111@newsletter', '📣 Fresh updates weekly')
|
|
829
|
+
|
|
830
|
+
// --- Change photo
|
|
831
|
+
sock.newsletterUpdatePicture('1211111111111@newsletter', {
|
|
832
|
+
url: 'path/to/image.jpg'
|
|
833
|
+
})
|
|
834
|
+
|
|
835
|
+
// --- Remove photo
|
|
836
|
+
sock.newsletterRemovePicture('1211111111111@newsletter')
|
|
837
|
+
|
|
838
|
+
// --- React to a message
|
|
839
|
+
sock.newsletterReactMessage('1211111111111@newsletter', '100', '💛')
|
|
840
|
+
|
|
841
|
+
// --- Get admin count
|
|
842
|
+
const count = await sock.newsletterAdminCount('1211111111111@newsletter')
|
|
843
|
+
|
|
844
|
+
// --- Get all subscribed newsletters
|
|
845
|
+
const newsletters = await sock.newsletterSubscribed()
|
|
846
|
+
console.dir(newsletters, { depth: null })
|
|
847
|
+
|
|
848
|
+
// --- Fetch newsletter messages
|
|
849
|
+
const messages = sock.newsletterFetchMessages('jid', '1211111111111@newsletter', 50, 0, 0)
|
|
850
|
+
console.dir(messages, { depth: null })
|
|
851
|
+
|
|
852
|
+
// --- Delete newsletter
|
|
853
|
+
sock.newsletterDelete('1211111111111@newsletter')
|
|
854
|
+
```
|
|
855
|
+
|
|
856
|
+
#### 👥 Group Management
|
|
857
|
+
|
|
858
|
+
```javascript
|
|
859
|
+
// --- Create a new one and add participants using their JIDs
|
|
860
|
+
const group = sock.groupCreate('@itsliaaa/starcore', ['6281111111111@s.whatsapp.net'])
|
|
861
|
+
console.dir(group, { depth: null })
|
|
862
|
+
|
|
863
|
+
// --- Get info
|
|
864
|
+
const metadata = await sock.groupMetadata(jid)
|
|
865
|
+
console.dir(metadata, { depth: null })
|
|
866
|
+
|
|
867
|
+
// --- Get group invite code
|
|
868
|
+
const inviteCode = await sock.groupInviteCode(jid)
|
|
869
|
+
console.dir(inviteCode, { depth: null })
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
// --- Revoke invite link
|
|
873
|
+
sock.groupRevokeInvite(jid)
|
|
874
|
+
|
|
875
|
+
// --- Accept group invite
|
|
876
|
+
sock.groupAcceptInvite(inviteCode)
|
|
877
|
+
|
|
878
|
+
// --- Leave group
|
|
879
|
+
sock.groupLeave(jid)
|
|
880
|
+
|
|
881
|
+
// --- Add participants
|
|
882
|
+
sock.groupParticipantsUpdate(jid, ['6281111111111@s.whatsapp.net'], 'add')
|
|
883
|
+
|
|
884
|
+
// --- Remove participants
|
|
885
|
+
sock.groupParticipantsUpdate(jid, ['6281111111111@s.whatsapp.net'], 'remove')
|
|
886
|
+
|
|
887
|
+
// --- Promote to admin
|
|
888
|
+
sock.groupParticipantsUpdate(jid, ['6281111111111@s.whatsapp.net'], 'promote')
|
|
889
|
+
|
|
890
|
+
// --- Demote from admin
|
|
891
|
+
sock.groupParticipantsUpdate(jid, ['6281111111111@s.whatsapp.net'], 'demote')
|
|
892
|
+
|
|
893
|
+
// --- Accept join requests
|
|
894
|
+
sock.groupRequestParticipantsUpdate(jid, ['6281111111111@s.whatsapp.net'], 'approve')
|
|
895
|
+
|
|
896
|
+
// --- Change name
|
|
897
|
+
sock.groupUpdateSubject(jid, '✨ @itsliaaa/starcore')
|
|
898
|
+
|
|
899
|
+
// --- Change description
|
|
900
|
+
sock.groupUpdateDescription(jid, 'Updated description')
|
|
901
|
+
|
|
902
|
+
// --- Change photo
|
|
903
|
+
sock.updateProfilePicture(jid, {
|
|
904
|
+
url: 'path/to/image.jpg'
|
|
905
|
+
})
|
|
906
|
+
|
|
907
|
+
// --- Remove photo
|
|
908
|
+
sock.removeProfilePicture(jid)
|
|
909
|
+
|
|
910
|
+
// --- Set group as admin only for chatting
|
|
911
|
+
sock.groupSettingUpdate(jid, 'announcement')
|
|
912
|
+
|
|
913
|
+
// --- Set group as open to all for chatting
|
|
914
|
+
sock.groupSettingUpdate(jid, 'not_announcement')
|
|
915
|
+
|
|
916
|
+
// --- Set admin only can edit group info
|
|
917
|
+
sock.groupSettingUpdate(jid, 'locked')
|
|
918
|
+
|
|
919
|
+
// --- Set all participants can edit group info
|
|
920
|
+
sock.groupSettingUpdate(jid, 'unlocked')
|
|
921
|
+
|
|
922
|
+
// --- Set admin only can add participants
|
|
923
|
+
sock.groupMemberAddMode(jid, 'admin_add')
|
|
924
|
+
|
|
925
|
+
// --- Set all participants can add participants
|
|
926
|
+
sock.groupMemberAddMode(jid, 'all_member_add')
|
|
927
|
+
|
|
928
|
+
// --- Enable or disable temporary messages with seconds format
|
|
929
|
+
sock.groupToggleEphemeral(jid, 86400)
|
|
930
|
+
|
|
931
|
+
// --- Disable temporary messages
|
|
932
|
+
sock.groupToggleEphemeral(jid, 0)
|
|
933
|
+
|
|
934
|
+
// --- Enable or disable membership approval mode
|
|
935
|
+
sock.groupJoinApprovalMode(jid, 'on')
|
|
936
|
+
sock.groupJoinApprovalMode(jid, 'off')
|
|
937
|
+
|
|
938
|
+
// --- Get all groups metadata
|
|
939
|
+
const groups = await sock.groupFetchAllParticipating()
|
|
940
|
+
console.dir(groups, { depth: null })
|
|
941
|
+
|
|
942
|
+
// --- Get pending join requests
|
|
943
|
+
const requests = await sock.groupRequestParticipantsList(jid)
|
|
944
|
+
console.dir(requests, { depth: null })
|
|
945
|
+
|
|
946
|
+
// --- Get group info from link
|
|
947
|
+
const group = await sock.groupGetInviteInfo('ABC123456789')
|
|
948
|
+
console.log('👥 Got group info from invite code', ':', group)
|
|
949
|
+
|
|
950
|
+
// --- Update bot member label
|
|
951
|
+
sock.updateMemberLabel(jid, '@itsliaaa/starcore')
|
|
952
|
+
```
|
|
953
|
+
|
|
954
|
+
#### 👥 Community Management
|
|
955
|
+
|
|
956
|
+
```javascript
|
|
957
|
+
// --- Create a new one and add description
|
|
958
|
+
const community = await sock.communityCreate('@itsliaaa/starcore', '📣 Fresh updates weekly')
|
|
959
|
+
console.dir(community, { depth: null })
|
|
960
|
+
|
|
961
|
+
// --- Create a subgroup for community and add participants using their JIDs
|
|
962
|
+
const group = await sock.communityCreateGroup('📢 Announcements', ['6281111111111@s.whatsapp.net'], communityJid)
|
|
963
|
+
|
|
964
|
+
// --- Link an existing group
|
|
965
|
+
sock.communityLinkGroup(groupJid, communityJid)
|
|
966
|
+
|
|
967
|
+
// --- Unlink an existing group
|
|
968
|
+
sock.communityUnlinkGroup(groupJid, communityJid)
|
|
969
|
+
|
|
970
|
+
// --- Get info
|
|
971
|
+
const metadata = await sock.communityMetadata(jid)
|
|
972
|
+
console.dir(metadata, { depth: null })
|
|
973
|
+
|
|
974
|
+
// --- Get community invite code
|
|
975
|
+
const inviteCode = await sock.communityInviteCode(jid)
|
|
976
|
+
console.dir(inviteCode, { depth: null })
|
|
977
|
+
|
|
978
|
+
// --- Revoke invite link
|
|
979
|
+
sock.communityRevokeInvite(jid)
|
|
980
|
+
|
|
981
|
+
// --- Accept community invite
|
|
982
|
+
sock.communityAcceptInvite(inviteCode)
|
|
983
|
+
|
|
984
|
+
// --- Leave community
|
|
985
|
+
sock.communityLeave(jid)
|
|
986
|
+
|
|
987
|
+
// --- Accept join requests
|
|
988
|
+
sock.communityRequestParticipantsUpdate(jid, ['6281111111111@s.whatsapp.net'], 'approve')
|
|
989
|
+
|
|
990
|
+
// --- Change name
|
|
991
|
+
sock.communityUpdateSubject(jid, '✨ @itsliaaa/starcore')
|
|
992
|
+
|
|
993
|
+
// --- Change description
|
|
994
|
+
sock.communityUpdateDescription(jid, 'Updated description')
|
|
995
|
+
|
|
996
|
+
// --- Set community as admin only for chatting
|
|
997
|
+
sock.communitySettingUpdate(jid, 'announcement')
|
|
998
|
+
|
|
999
|
+
// --- Set community as open to all for chatting
|
|
1000
|
+
sock.communitySettingUpdate(jid, 'not_announcement')
|
|
1001
|
+
|
|
1002
|
+
// --- Set admin only can edit community info
|
|
1003
|
+
sock.communitySettingUpdate(jid, 'locked')
|
|
1004
|
+
|
|
1005
|
+
// --- Set all participants can edit community info
|
|
1006
|
+
sock.communitySettingUpdate(jid, 'unlocked')
|
|
1007
|
+
|
|
1008
|
+
// --- Set admin only can add participants
|
|
1009
|
+
sock.communityMemberAddMode(jid, 'admin_add')
|
|
1010
|
+
|
|
1011
|
+
// --- Set all participants can add participants
|
|
1012
|
+
sock.communityMemberAddMode(jid, 'all_member_add')
|
|
1013
|
+
|
|
1014
|
+
// --- Enable or disable temporary messages with seconds format
|
|
1015
|
+
sock.communityToggleEphemeral(jid, 86400)
|
|
1016
|
+
|
|
1017
|
+
// --- Disable temporary messages
|
|
1018
|
+
sock.communityToggleEphemeral(jid, 0)
|
|
1019
|
+
|
|
1020
|
+
// --- Enable or disable membership approval mode
|
|
1021
|
+
sock.communityJoinApprovalMode(jid, 'on')
|
|
1022
|
+
sock.communityJoinApprovalMode(jid, 'off')
|
|
1023
|
+
|
|
1024
|
+
// --- Get all communities metadata
|
|
1025
|
+
const communities = await sock.communityFetchAllParticipating()
|
|
1026
|
+
console.dir(communities, { depth: null })
|
|
1027
|
+
|
|
1028
|
+
// --- Get all community linked groups
|
|
1029
|
+
const linked = await sock.communityFetchLinkedGroups(jid)
|
|
1030
|
+
console.dir(linked, { depth: null })
|
|
1031
|
+
|
|
1032
|
+
// --- Get pending join requests
|
|
1033
|
+
const requests = await sock.communityRequestParticipantsList(jid)
|
|
1034
|
+
console.dir(requests, { depth: null })
|
|
1035
|
+
|
|
1036
|
+
// --- Get community info from link
|
|
1037
|
+
const community = await sock.communityGetInviteInfo('ABC123456789')
|
|
1038
|
+
console.log('👥 Got community info from invite code', ':', community)
|
|
1039
|
+
```
|
|
1040
|
+
|
|
1041
|
+
#### 👤 Profile Management
|
|
1042
|
+
|
|
1043
|
+
```javascript
|
|
1044
|
+
// --- Get user profile picture
|
|
1045
|
+
const url = await sock.profilePictureUrl(jid, 'image')
|
|
1046
|
+
console.log('🖼️ Got user profile url', url)
|
|
1047
|
+
|
|
1048
|
+
// --- Update profile picture
|
|
1049
|
+
sock.updateProfilePicture(jid, buffer)
|
|
1050
|
+
sock.updateProfilePicture(jid, { url })
|
|
1051
|
+
|
|
1052
|
+
// --- Remove profile picture
|
|
1053
|
+
sock.removeProfilePicture(jid)
|
|
1054
|
+
|
|
1055
|
+
// --- Update profile name
|
|
1056
|
+
sock.updateProfileName('My Name')
|
|
1057
|
+
|
|
1058
|
+
// --- Update profile status
|
|
1059
|
+
sock.updateProfileStatus('Available')
|
|
1060
|
+
|
|
1061
|
+
// --- Presence
|
|
1062
|
+
sock.sendPresenceUpdate('available', jid)
|
|
1063
|
+
sock.presenceSubscribe(jid)
|
|
1064
|
+
|
|
1065
|
+
// --- Read receipts
|
|
1066
|
+
sock.readMessages([message.key])
|
|
1067
|
+
sock.sendReceipt(jid, participant, [messageId], 'read')
|
|
1068
|
+
|
|
1069
|
+
// --- Block user
|
|
1070
|
+
sock.updateBlockStatus(jid, 'block')
|
|
1071
|
+
|
|
1072
|
+
// --- Unblock user
|
|
1073
|
+
sock.updateBlockStatus(jid, 'unblock')
|
|
1074
|
+
|
|
1075
|
+
// --- Fetch blocklist
|
|
1076
|
+
const blocked = await sock.fetchBlocklist()
|
|
1077
|
+
console.dir(blocked, { depth: null })
|
|
1078
|
+
|
|
1079
|
+
// --- Modify chats
|
|
1080
|
+
sock.chatModify({
|
|
1081
|
+
archive: true,
|
|
1082
|
+
lastMessageOrig: message,
|
|
1083
|
+
lastMessage: message
|
|
1084
|
+
}, jid)
|
|
1085
|
+
|
|
1086
|
+
// --- Star messages
|
|
1087
|
+
sock.star(jid, [{ id: messageId, fromMe: true }], true)
|
|
1088
|
+
|
|
1089
|
+
// --- Contact
|
|
1090
|
+
sock.addOrEditContact(jid, { displayName: 'Starseed' })
|
|
1091
|
+
sock.removeContact(jid)
|
|
1092
|
+
|
|
1093
|
+
// --- Label
|
|
1094
|
+
sock.addChatLabel(jid, labelId)
|
|
1095
|
+
sock.removeChatLabel(jid, labelId)
|
|
1096
|
+
sock.addMessageLabel(jid, messageId, labelId)
|
|
1097
|
+
|
|
1098
|
+
// --- Favorites
|
|
1099
|
+
sock.keepFavorites([
|
|
1100
|
+
'6281111111111@s.whatsapp.net',
|
|
1101
|
+
'1211111111111@g.us'
|
|
1102
|
+
])
|
|
1103
|
+
sock.keepFavorites([
|
|
1104
|
+
'6281111111111@s.whatsapp.net' // only this one remains
|
|
1105
|
+
])
|
|
1106
|
+
|
|
1107
|
+
// --- App state sync
|
|
1108
|
+
sock.resyncAppState(['regular', 'critical_block'], true)
|
|
1109
|
+
|
|
1110
|
+
// --- Get business profile
|
|
1111
|
+
const profile = await sock.getBusinessProfile(jid)
|
|
1112
|
+
console.dir(profile, { depth: null })
|
|
1113
|
+
```
|
|
1114
|
+
|
|
1115
|
+
#### 🛒 Business Management
|
|
1116
|
+
|
|
1117
|
+
```javascript
|
|
1118
|
+
// --- Create a new product
|
|
1119
|
+
const product = await sock.productCreate({
|
|
1120
|
+
name: '🧩 Starseed (Premium)',
|
|
1121
|
+
description: 'Get a full version of Starseed!',
|
|
1122
|
+
price: 100000,
|
|
1123
|
+
currency: 'IDR',
|
|
1124
|
+
originCountryCode: 'ID',
|
|
1125
|
+
images: [
|
|
1126
|
+
bufferImage,
|
|
1127
|
+
{
|
|
1128
|
+
url: './path/to/image.jpg'
|
|
1129
|
+
}
|
|
1130
|
+
]
|
|
1131
|
+
})
|
|
1132
|
+
console.dir(product, { depth: null })
|
|
1133
|
+
|
|
1134
|
+
// --- Update product
|
|
1135
|
+
await sock.productUpdate(productId, {
|
|
1136
|
+
name: '🧩 Starseed (Premium)',
|
|
1137
|
+
description: 'Get a full version of Starseed with more features!',
|
|
1138
|
+
price: 75000,
|
|
1139
|
+
currency: 'IDR',
|
|
1140
|
+
images: [
|
|
1141
|
+
{
|
|
1142
|
+
url: './path/to/image.jpg'
|
|
1143
|
+
}
|
|
1144
|
+
]
|
|
1145
|
+
})
|
|
1146
|
+
|
|
1147
|
+
// --- Delete product
|
|
1148
|
+
sock.productDelete([productId])
|
|
1149
|
+
|
|
1150
|
+
// --- Get catalog info
|
|
1151
|
+
const { products, nextPageCursor } = await sock.getCatalog({
|
|
1152
|
+
jid: '6281111111111@s.whatsapp.net',
|
|
1153
|
+
limit: 10
|
|
1154
|
+
})
|
|
1155
|
+
|
|
1156
|
+
// --- Get collections
|
|
1157
|
+
const collections = await sock.getCollections('6281111111111@s.whatsapp.net', 10)
|
|
1158
|
+
console.dir(collections, { depth: null })
|
|
1159
|
+
|
|
1160
|
+
// --- Get order info
|
|
1161
|
+
const order = await sock.getOrderDetails(orderId, tokenBase64)
|
|
1162
|
+
console.dir(order, { depth: null })
|
|
1163
|
+
|
|
1164
|
+
// --- Update business profile
|
|
1165
|
+
await sock.updateBusinessProfile({
|
|
1166
|
+
address: 'Jakarta, Indonesia',
|
|
1167
|
+
description: '🛒 Official Starseed Store',
|
|
1168
|
+
websites: ['https://www.npmjs.com/package/@itsliaaa/starcore'],
|
|
1169
|
+
email: 'more-more@gmail.com',
|
|
1170
|
+
hours: {
|
|
1171
|
+
timezone: 'Asia/Jakarta',
|
|
1172
|
+
days: [{ day: 'mon', mode: 'open_24h' }]
|
|
1173
|
+
}
|
|
1174
|
+
})
|
|
1175
|
+
|
|
1176
|
+
// --- Update cover
|
|
1177
|
+
sock.updateCoverPhoto({
|
|
1178
|
+
url: './path/to/image.jpg'
|
|
1179
|
+
})
|
|
1180
|
+
|
|
1181
|
+
// --- Remove cover
|
|
1182
|
+
sock.removeCoverPhoto(coverId)
|
|
1183
|
+
|
|
1184
|
+
// --- Update quick replies
|
|
1185
|
+
sock.addOrEditQuickReply({
|
|
1186
|
+
shortcut: 'hello',
|
|
1187
|
+
message: 'Hello from business account',
|
|
1188
|
+
})
|
|
1189
|
+
|
|
1190
|
+
// --- Remove quick reply
|
|
1191
|
+
sock.removeQuickReply(timestamp)
|
|
1192
|
+
```
|
|
1193
|
+
|
|
1194
|
+
#### 🔐 Privacy Management
|
|
1195
|
+
|
|
1196
|
+
```javascript
|
|
1197
|
+
// --- Update last seen privacy
|
|
1198
|
+
sock.updateLastSeenPrivacy('all')
|
|
1199
|
+
sock.updateLastSeenPrivacy('contacts')
|
|
1200
|
+
sock.updateLastSeenPrivacy('contact_blacklist')
|
|
1201
|
+
sock.updateLastSeenPrivacy('nobody')
|
|
1202
|
+
|
|
1203
|
+
// --- Update online privacy
|
|
1204
|
+
sock.updateOnlinePrivacy('all')
|
|
1205
|
+
sock.updateOnlinePrivacy('match_last_seen')
|
|
1206
|
+
|
|
1207
|
+
// --- Update profile picture privacy
|
|
1208
|
+
sock.updateProfilePicturePrivacy('contacts')
|
|
1209
|
+
|
|
1210
|
+
// --- Update status privacy
|
|
1211
|
+
sock.updateStatusPrivacy('contacts')
|
|
1212
|
+
|
|
1213
|
+
// --- Update read receipts privacy
|
|
1214
|
+
sock.updateReadReceiptsPrivacy('all')
|
|
1215
|
+
sock.updateReadReceiptsPrivacy('none')
|
|
1216
|
+
|
|
1217
|
+
// --- Update groups add privacy
|
|
1218
|
+
sock.updateGroupsAddPrivacy('all')
|
|
1219
|
+
sock.updateGroupsAddPrivacy('contacts')
|
|
1220
|
+
|
|
1221
|
+
// --- Update messages privacy
|
|
1222
|
+
sock.updateMessagesPrivacy('all')
|
|
1223
|
+
sock.updateMessagesPrivacy('contacts')
|
|
1224
|
+
sock.updateMessagesPrivacy('nobody')
|
|
1225
|
+
|
|
1226
|
+
// --- Update call privacy
|
|
1227
|
+
sock.updateCallPrivacy('everyone')
|
|
1228
|
+
|
|
1229
|
+
// --- Update default disappearing mode
|
|
1230
|
+
sock.updateDefaultDisappearingMode(86400)
|
|
1231
|
+
|
|
1232
|
+
// --- Update link previews privacy
|
|
1233
|
+
sock.updateDisableLinkPreviewsPrivacy(true)
|
|
1234
|
+
```
|
|
1235
|
+
|
|
1236
|
+
#### 📡 Baileys Events Reference
|
|
1237
|
+
|
|
1238
|
+
```javascript
|
|
1239
|
+
sock.ev.on('connection.update', console.log)
|
|
1240
|
+
sock.ev.on('creds.update', console.log)
|
|
1241
|
+
sock.ev.on('messaging-history.set', console.log)
|
|
1242
|
+
sock.ev.on('messaging-history.status', console.log)
|
|
1243
|
+
sock.ev.on('chats.upsert', console.log)
|
|
1244
|
+
sock.ev.on('chats.update', console.log)
|
|
1245
|
+
sock.ev.on('chats.delete', console.log)
|
|
1246
|
+
sock.ev.on('chats.lock', console.log)
|
|
1247
|
+
sock.ev.on('lid-mapping.update', console.log)
|
|
1248
|
+
sock.ev.on('presence.update', console.log)
|
|
1249
|
+
sock.ev.on('contacts.upsert', console.log)
|
|
1250
|
+
sock.ev.on('contacts.update', console.log)
|
|
1251
|
+
sock.ev.on('messages.delete', console.log)
|
|
1252
|
+
sock.ev.on('messages.update', console.log)
|
|
1253
|
+
sock.ev.on('messages.media-update', console.log)
|
|
1254
|
+
sock.ev.on('messages.upsert', console.log)
|
|
1255
|
+
sock.ev.on('messages.reaction', console.log)
|
|
1256
|
+
sock.ev.on('message-receipt.update', console.log)
|
|
1257
|
+
sock.ev.on('groups.upsert', console.log)
|
|
1258
|
+
sock.ev.on('groups.update', console.log)
|
|
1259
|
+
sock.ev.on('group-participants.update', console.log)
|
|
1260
|
+
sock.ev.on('group.join-request', console.log)
|
|
1261
|
+
sock.ev.on('group.member-tag.update', console.log)
|
|
1262
|
+
sock.ev.on('blocklist.set', console.log)
|
|
1263
|
+
sock.ev.on('blocklist.update', console.log)
|
|
1264
|
+
sock.ev.on('call', console.log)
|
|
1265
|
+
sock.ev.on('labels.edit', console.log)
|
|
1266
|
+
sock.ev.on('labels.association', console.log)
|
|
1267
|
+
sock.ev.on('newsletter.reaction', console.log)
|
|
1268
|
+
sock.ev.on('newsletter.view', console.log)
|
|
1269
|
+
sock.ev.on('newsletter-participants.update', console.log)
|
|
1270
|
+
sock.ev.on('newsletter-settings.update', console.log)
|
|
1271
|
+
sock.ev.on('settings.update', console.log)
|
|
1272
|
+
```
|
|
1273
|
+
|
|
675
1274
|
### 🗳️ Database
|
|
676
1275
|
|
|
677
1276
|
> [!IMPORTANT]
|
|
@@ -744,7 +1343,7 @@ import {
|
|
|
744
1343
|
|
|
745
1344
|
### 🚀 Try the Bot
|
|
746
1345
|
|
|
747
|
-
A fast, lightweight, and modular WhatsApp bot built with [@itsliaaa/
|
|
1346
|
+
A fast, lightweight, and modular WhatsApp bot built with [@itsliaaa/baileys](https://www.npmjs.com/package/@itsliaaa/baileys).
|
|
748
1347
|
Perfect for managing groups, moderating chats, and adding fun with quiz games and handy tools.
|
|
749
1348
|
|
|
750
1349
|
👉🏻 [@itsliaaa/starseed](https://github.com/itsliaaa/starseed#readme)
|