@itznomo/baileys 0.0.0-stage โ 0.0.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/BUTTONS.md +153 -0
- package/Example/call-bot.mjs +38 -0
- package/Example/example.mjs +36 -0
- package/Example/full-bot-commands.mjs +319 -0
- package/Example/full-bot.mjs +77 -0
- package/LICENSE +21 -0
- package/README.md +543 -2
- package/WAProto/@dnuzi +1 -0
- package/WAProto/index.d.ts +15932 -0
- package/WAProto/index.js +113300 -0
- package/assets/banner.svg +17 -0
- package/assets/devider.svg +1 -0
- package/assets/features.svg +21 -0
- package/docs/CALLS.md +106 -0
- package/docs/FEATURES.md +1152 -0
- package/engine-requirements.js +19 -0
- package/index.d.ts +815 -0
- package/package.json +51 -4
- package/src/binary/wa-binary-constants.js +1300 -0
- package/src/binary/wa-binary.js +627 -0
- package/src/constants.js +147 -0
- package/src/defaults.js +106 -0
- package/src/foundation/ai-rich.js +654 -0
- package/src/foundation/audio-duration.js +470 -0
- package/src/foundation/audio-samples.js +250 -0
- package/src/foundation/boom.js +39 -0
- package/src/foundation/builders.js +851 -0
- package/src/foundation/cache.js +134 -0
- package/src/foundation/concurrency.js +69 -0
- package/src/foundation/curve25519.js +189 -0
- package/src/foundation/image-thumb.js +65 -0
- package/src/foundation/link-preview.js +278 -0
- package/src/foundation/logger.js +78 -0
- package/src/foundation/long.js +130 -0
- package/src/foundation/performance.js +385 -0
- package/src/foundation/protobuf-minimal.js +587 -0
- package/src/foundation/qrcode-terminal.js +273 -0
- package/src/foundation/sql-database.js +716 -0
- package/src/foundation/wa-crypto.js +47 -0
- package/src/foundation/zip.js +108 -0
- package/src/index.js +67 -0
- package/src/signal/libsignal.js +996 -0
- package/src/signal/signal-group.js +455 -0
- package/src/signal/signal-repository.js +635 -0
- package/src/socket/business-communities.js +811 -0
- package/src/socket/chats.js +702 -0
- package/src/socket/groups-newsletter.js +524 -0
- package/src/socket/messages-recv.js +1815 -0
- package/src/socket/messages-send.js +1526 -0
- package/src/socket/socket-builder.js +131 -0
- package/src/socket/socket-core.js +913 -0
- package/src/socket/usync.js +287 -0
- package/src/socket-client/native-websocket.js +344 -0
- package/src/socket-client/websocket-client.js +170 -0
- package/src/utils/auth-state-core.js +731 -0
- package/src/utils/auth-state-storage.js +594 -0
- package/src/utils/chat-sync.js +1046 -0
- package/src/utils/check-status.js +159 -0
- package/src/utils/cstoken.js +17 -0
- package/src/utils/media.js +807 -0
- package/src/utils/message-compose.js +1747 -0
- package/src/utils/message-processing.js +912 -0
- package/src/utils/modern-messages.js +435 -0
- package/src/utils/nomo-buttons.js +138 -0
- package/src/utils/nomo-commands.js +168 -0
- package/src/utils/spam-report-utils.js +136 -0
- package/src/utils/use-keyv-auth-state.js +307 -0
- package/src/utils/username.js +19 -0
- package/src/utils/wa-protocol-core.js +1227 -0
- package/src/voip/WaVoipCoordinator.js +158 -0
- package/src/voip/app-data/WaAppDataStream.js +193 -0
- package/src/voip/app-data/protocol.js +172 -0
- package/src/voip/auto.js +139 -0
- package/src/voip/bytes.js +63 -0
- package/src/voip/call/WaCallManager.js +442 -0
- package/src/voip/call/WaCallMediaSession.js +1727 -0
- package/src/voip/call/call-state.js +203 -0
- package/src/voip/crypto/encryption.js +13 -0
- package/src/voip/crypto/primitives.js +21 -0
- package/src/voip/crypto/rtcp.js +66 -0
- package/src/voip/crypto/srtp.js +180 -0
- package/src/voip/crypto/ssrc.js +15 -0
- package/src/voip/index.js +730 -0
- package/src/voip/media/WaAudioEngine.js +486 -0
- package/src/voip/media/WaVideoEngine.js +275 -0
- package/src/voip/media/audio-codec.js +0 -0
- package/src/voip/media/audio-reorder.js +107 -0
- package/src/voip/media/h264.js +246 -0
- package/src/voip/media/mlow-codec.js +465 -0
- package/src/voip/media/rtcp.js +68 -0
- package/src/voip/media/rtp.js +242 -0
- package/src/voip/protobuf.js +30 -0
- package/src/voip/relay/WaManualRelay.js +609 -0
- package/src/voip/relay/datachannel/pre-negotiated.js +25 -0
- package/src/voip/relay/dtls/aead.js +46 -0
- package/src/voip/relay/dtls/cert-builder.js +102 -0
- package/src/voip/relay/dtls/der.js +98 -0
- package/src/voip/relay/dtls/ecdhe.js +37 -0
- package/src/voip/relay/dtls/handshake-framing.js +100 -0
- package/src/voip/relay/dtls/handshake-messages.js +158 -0
- package/src/voip/relay/dtls/handshake.js +582 -0
- package/src/voip/relay/dtls/prf.js +39 -0
- package/src/voip/relay/dtls/record.js +56 -0
- package/src/voip/relay/relay-ack.js +141 -0
- package/src/voip/relay/sctp/association.js +434 -0
- package/src/voip/relay/sctp/crc32c.js +21 -0
- package/src/voip/relay/sctp/wire.js +226 -0
- package/src/voip/relay/stun.js +463 -0
- package/src/voip/shim/baileys-resolve.js +7 -0
- package/src/voip/shim/core.js +66 -0
- package/src/voip/shim/crypto.js +6 -0
- package/src/voip/shim/proto.js +10 -0
- package/src/voip/shim/protocol.js +130 -0
- package/src/voip/shim/transport.js +82 -0
- package/src/voip/shim/util.js +207 -0
- package/src/voip/signaling/bridge.js +102 -0
- package/src/voip/signaling/screen-share.js +60 -0
- package/src/voip/signaling/signaling.js +491 -0
- package/src/voip/types.js +69 -0
- package/src/voip/voip-deps.js +243 -0
- package/src/voip/voipClient.js +314 -0
- package/src/wam/wam-constants.js +22852 -0
- package/src/wam/wam.js +146 -0
- package/voip.d.ts +144 -0
package/README.md
CHANGED
|
@@ -1,3 +1,544 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/banner.svg" alt="NOMO BAILEYS" width="100%" />
|
|
4
|
+
|
|
5
|
+
<br/>
|
|
6
|
+
|
|
7
|
+
# NOMO BAILEYS
|
|
8
|
+
|
|
9
|
+
**An all-in-one WhatsApp Web API for Node.js: buttons, calls and a ready-made command router.**
|
|
10
|
+
|
|
11
|
+
[](https://nodejs.org)
|
|
12
|
+
[](https://www.npmjs.com/package/@itznomo/ballieys)
|
|
13
|
+
[](#-bot-commands)
|
|
14
|
+
[](https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/LICENSE)
|
|
15
|
+
[](https://anuhas.site)
|
|
16
|
+
|
|
17
|
+
[Install](#-install) ยท [Quick Start](#-quick-start) ยท [Run the Bot](#-run-the-example-bot) ยท [Buttons](#-buttons-lists--carousel) ยท [Router](#-command-router) ยท [Calls](#-calls) ยท [Commands](#-bot-commands) ยท [Credits](#-credits)
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
22
|
+
|
|
23
|
+
## โจ Highlights
|
|
24
|
+
|
|
25
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/features.svg" width="100%" alt="Buttons and lists, command router, voice and video calls, AI rich messages, zero dependencies"/></p>
|
|
26
|
+
|
|
27
|
+
| | |
|
|
28
|
+
|---|---|
|
|
29
|
+
| ๐ **Interactive** | Native flow buttons, classic buttons, lists, carousel, widgets (A2UI), template buttons |
|
|
30
|
+
| ๐ง **Command router** | Aliases, cooldowns, owner-only, group-only, button taps as commands, auto menu |
|
|
31
|
+
| ๐ **Calls** | Audio and video calls, playlists, multi-call, auto answer, auto reject, call history |
|
|
32
|
+
| ๐ค **AI Rich** | Rich messages with code blocks, tables, images and sources |
|
|
33
|
+
| ๐ฌ **Messages** | Text, mentions, polls, events, locations, contacts, media, stickers, view once, albums, edit, delete |
|
|
34
|
+
| ๐ฅ **Groups & Channels** | Groups, communities, newsletters, status and stories |
|
|
35
|
+
| ๐ณ **Commerce** | Payments, orders and products |
|
|
36
|
+
| ๐๏ธ **Sessions** | Multi-file, single-file, SQLite, MongoDB and Keyv auth storage |
|
|
37
|
+
| ๐ฆ **Dependencies** | Zero runtime dependencies, no native or WebRTC builds |
|
|
38
|
+
| ๐ฆ **Types** | TypeScript definitions included (`index.d.ts`, `voip.d.ts`) |
|
|
39
|
+
|
|
40
|
+
Created and maintained by **NOMO DEV (Anuhas Bandara)** in Sri Lanka ๐ฑ๐ฐ
|
|
41
|
+
|
|
42
|
+
> NOMO BAILEYS combines the WhatsApp runtime, the button helpers and the command router into one package, designed and put together by **Anuhas Bandara**.
|
|
43
|
+
|
|
44
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
45
|
+
|
|
46
|
+
## ๐ฅ Install
|
|
47
|
+
|
|
48
|
+
Requires **Node.js 18+** and **FFmpeg**. Calls also need `ffprobe` available in `PATH`.
|
|
49
|
+
|
|
50
|
+
````bash
|
|
51
|
+
npm i @itznomo/ballieys
|
|
52
|
+
````
|
|
53
|
+
|
|
54
|
+
> Import it as `@itznomo/ballieys`.
|
|
55
|
+
|
|
56
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
57
|
+
|
|
58
|
+
## ๐ Quick Start
|
|
59
|
+
|
|
60
|
+
A bot that links by QR code and answers `.ping` and `.hi` using the built-in command router.
|
|
61
|
+
|
|
62
|
+
````javascript
|
|
63
|
+
import makeWASocket, {
|
|
64
|
+
useMultiFileAuthState,
|
|
65
|
+
createCommandRouter,
|
|
66
|
+
quickReplyButton,
|
|
67
|
+
urlButton
|
|
68
|
+
} from '@itznomo/ballieys'
|
|
69
|
+
|
|
70
|
+
const { state, saveCreds } = await useMultiFileAuthState('./auth')
|
|
71
|
+
const sock = makeWASocket({ auth: state })
|
|
72
|
+
sock.ev.on('creds.update', saveCreds)
|
|
73
|
+
|
|
74
|
+
const bot = createCommandRouter(sock, { prefix: '.', owners: ['947XXXXXXXX'] })
|
|
75
|
+
|
|
76
|
+
bot.command('menu', ctx => bot.sendMenu(ctx.jid, { title: 'My Bot' }), {
|
|
77
|
+
description: 'Show menu',
|
|
78
|
+
category: 'Basic'
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
bot.command('ping', ctx => ctx.reply('pong'), {
|
|
82
|
+
description: 'Latency',
|
|
83
|
+
category: 'Basic'
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
bot.command('hi', ctx => ctx.reply({
|
|
87
|
+
text: 'Hello',
|
|
88
|
+
interactiveButtons: [
|
|
89
|
+
quickReplyButton('Ping', '.ping'),
|
|
90
|
+
urlButton('Website', 'https://anuhas.site')
|
|
91
|
+
]
|
|
92
|
+
}), { description: 'Buttons', category: 'Basic', cooldownMs: 3000 })
|
|
93
|
+
|
|
94
|
+
bot.attach()
|
|
95
|
+
````
|
|
96
|
+
|
|
97
|
+
**How to link**
|
|
98
|
+
|
|
99
|
+
| Method | Steps |
|
|
100
|
+
|---|---|
|
|
101
|
+
| QR code | Run the bot, then scan from *Linked devices โ Link a device* |
|
|
102
|
+
| Pairing code | Set `PHONE_NUMBER`, choose *Link with phone number instead*, enter the code |
|
|
103
|
+
|
|
104
|
+
> Your login is stored in `./auth`. Keep it private and out of git. Add it to your `.gitignore`.
|
|
105
|
+
|
|
106
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
107
|
+
|
|
108
|
+
## โก Run the example bot
|
|
109
|
+
|
|
110
|
+
The package ships a full bot with **55 commands** in `Example/full-bot.mjs`.
|
|
111
|
+
|
|
112
|
+
````bash
|
|
113
|
+
node node_modules/@itznomo/ballieys/Example/full-bot.mjs # scan the QR code
|
|
114
|
+
PHONE_NUMBER=947XXXXXXXX node node_modules/@itznomo/ballieys/Example/full-bot.mjs # pairing code instead of QR
|
|
115
|
+
OWNER_NUMBER=947XXXXXXXX node node_modules/@itznomo/ballieys/Example/full-bot.mjs # enable owner-only commands
|
|
116
|
+
````
|
|
117
|
+
|
|
118
|
+
| Variable | Meaning |
|
|
119
|
+
|---|---|
|
|
120
|
+
| `OWNER_EMAIL` | Contact email shown by `.owner` (default `anuhazdev@gmail.com`) |
|
|
121
|
+
| `OWNER_NUMBER` | Owner number(s), comma separated. Needed for owner-only commands |
|
|
122
|
+
| `PHONE_NUMBER` | Number to link with a pairing code |
|
|
123
|
+
| `PREFIX` | Command prefix (default `.`) |
|
|
124
|
+
| `BOT_NAME` | Name shown in menus |
|
|
125
|
+
| `SESSION_DIR` | Session folder (default `./auth`) |
|
|
126
|
+
|
|
127
|
+
> โ ๏ธ Never upload the `auth/` folder. It is your WhatsApp session. Use a spare number first.
|
|
128
|
+
|
|
129
|
+
Other examples are in the `Example/` folder of the package.
|
|
130
|
+
|
|
131
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
132
|
+
|
|
133
|
+
## ๐๏ธ Buttons, lists & carousel
|
|
134
|
+
|
|
135
|
+
Everything goes through the normal `sock.sendMessage(jid, content)` call.
|
|
136
|
+
|
|
137
|
+
### Native flow buttons
|
|
138
|
+
|
|
139
|
+
````javascript
|
|
140
|
+
import { quickReplyButton, urlButton, copyButton, callButton } from '@itznomo/ballieys'
|
|
141
|
+
|
|
142
|
+
await sock.sendMessage(jid, {
|
|
143
|
+
text: 'Pick one',
|
|
144
|
+
footer: 'NOMO',
|
|
145
|
+
interactiveButtons: [
|
|
146
|
+
quickReplyButton('Menu', '.menu'),
|
|
147
|
+
urlButton('Website', 'https://example.com'),
|
|
148
|
+
copyButton('Copy code', 'ABC-123'),
|
|
149
|
+
callButton('Call', '+947XXXXXXXX')
|
|
150
|
+
]
|
|
151
|
+
})
|
|
152
|
+
````
|
|
153
|
+
|
|
154
|
+
### Drop-down list
|
|
155
|
+
|
|
156
|
+
````javascript
|
|
157
|
+
import { singleSelectButton } from '@itznomo/ballieys'
|
|
158
|
+
|
|
159
|
+
await sock.sendMessage(jid, {
|
|
160
|
+
image: { url: './Media/logo.png' },
|
|
161
|
+
caption: 'Pick a tool',
|
|
162
|
+
interactiveButtons: [
|
|
163
|
+
singleSelectButton('Open menu', [{
|
|
164
|
+
title: 'Tools',
|
|
165
|
+
rows: [
|
|
166
|
+
{ id: '.sticker', title: 'Sticker', description: 'Image to sticker' },
|
|
167
|
+
{ id: '.song', title: 'Song', description: 'Download audio' }
|
|
168
|
+
]
|
|
169
|
+
}])
|
|
170
|
+
]
|
|
171
|
+
})
|
|
172
|
+
````
|
|
173
|
+
|
|
174
|
+
### Carousel
|
|
175
|
+
|
|
176
|
+
````javascript
|
|
177
|
+
await sock.sendMessage(jid, {
|
|
178
|
+
text: 'Swipe the cards',
|
|
179
|
+
cards: [
|
|
180
|
+
{ image: { url: './Media/cat.jpeg' }, title: 'Cat', body: 'A cat photo', buttons: [quickReplyButton('Image', '.image')] },
|
|
181
|
+
{ image: { url: './Media/meme.jpeg' }, title: 'Meme', body: 'A meme', buttons: [urlButton('Website', 'https://anuhas.site')] }
|
|
182
|
+
]
|
|
183
|
+
})
|
|
184
|
+
````
|
|
185
|
+
|
|
186
|
+
### Reading what the user tapped
|
|
187
|
+
|
|
188
|
+
````javascript
|
|
189
|
+
import { getButtonReply } from '@itznomo/ballieys'
|
|
190
|
+
|
|
191
|
+
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
192
|
+
const reply = getButtonReply(messages[0])
|
|
193
|
+
if (reply) console.log(reply.kind, reply.id, reply.displayText)
|
|
194
|
+
// e.g. 'native_flow' '.menu' 'Menu'
|
|
195
|
+
})
|
|
196
|
+
````
|
|
197
|
+
|
|
198
|
+
The `id` is exactly what you passed as `id`, `buttonId` or `rowId`. Use your command text (`.menu`) as the id and a tap runs the command.
|
|
199
|
+
|
|
200
|
+
### Two ways to write buttons
|
|
201
|
+
|
|
202
|
+
````javascript
|
|
203
|
+
// nomo style
|
|
204
|
+
await sock.sendMessage(jid, { text: 'Hi', interactiveButtons: [quickReplyButton('Menu', '.menu')] })
|
|
205
|
+
|
|
206
|
+
// compact style
|
|
207
|
+
await sock.sendMessage(jid, { text: 'Hi', nativeFlow: [{ text: 'Menu', id: '.menu' }, { text: 'Site', url: 'https://example.com' }] })
|
|
208
|
+
````
|
|
209
|
+
|
|
210
|
+
Classic `buttons`, classic `sections` lists, widgets and template buttons are all covered in [`BUTTONS.md`](https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/BUTTONS.md) and [`docs/FEATURES.md`](https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/docs/FEATURES.md).
|
|
211
|
+
|
|
212
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
213
|
+
|
|
214
|
+
## ๐ง Command router
|
|
215
|
+
|
|
216
|
+
A small router built for bots that use buttons and lists. Button and list taps arrive as normal commands.
|
|
217
|
+
|
|
218
|
+
````javascript
|
|
219
|
+
const bot = createCommandRouter(sock, {
|
|
220
|
+
prefix: '.',
|
|
221
|
+
owners: ['947XXXXXXXX'],
|
|
222
|
+
cooldownMs: 0, // default cooldown for every command
|
|
223
|
+
onDenied: (ctx, reason, wait) => {}, // 'owner_only' | 'group_only' | 'private_only' | 'cooldown'
|
|
224
|
+
onUnknown: ctx => {},
|
|
225
|
+
onError: (error, ctx) => {}
|
|
226
|
+
})
|
|
227
|
+
|
|
228
|
+
bot.command(['song', 'play'], async ctx => {
|
|
229
|
+
await ctx.reply(`You asked for: ${ctx.args.join(' ')}`)
|
|
230
|
+
}, { description: 'Download audio', category: 'Tools', cooldownMs: 5000 })
|
|
231
|
+
|
|
232
|
+
bot.attach() // listens to messages.upsert
|
|
233
|
+
await bot.sendMenu(jid, { title: 'Menu' })
|
|
234
|
+
````
|
|
235
|
+
|
|
236
|
+
| `meta` option | What it does |
|
|
237
|
+
|---|---|
|
|
238
|
+
| `description` | Shown in the auto menu. Commands without one stay out of the menu |
|
|
239
|
+
| `category` | Groups commands in the drop-down menu |
|
|
240
|
+
| `ownerOnly` | Only numbers in `owners` can run it |
|
|
241
|
+
| `groupOnly` / `privateOnly` | Restrict to groups or private chats |
|
|
242
|
+
| `cooldownMs` | Per user cooldown (owners skip it) |
|
|
243
|
+
| `hidden` | Works, but is not listed in the menu |
|
|
244
|
+
|
|
245
|
+
The handler gets `ctx = { sock, msg, jid, sender, text, args, command, isGroup, isOwner, buttonReply, reply(content) }`.
|
|
246
|
+
|
|
247
|
+
`sendMenu` sends a drop-down list by default, or quick reply buttons for up to 3 commands (`style: 'buttons'` or `'list'` to force one).
|
|
248
|
+
|
|
249
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
250
|
+
|
|
251
|
+
## ๐ Calls
|
|
252
|
+
|
|
253
|
+
Calls need `ffmpeg` and `ffprobe` in `PATH`. Create **one `Voip` per socket** after it opens. After a reconnect you get a new socket, so create a new `Voip`.
|
|
254
|
+
|
|
255
|
+
### Auto answer with music
|
|
256
|
+
|
|
257
|
+
````javascript
|
|
258
|
+
import Voip from '@itznomo/ballieys/voip'
|
|
259
|
+
|
|
260
|
+
const voip = new Voip(sock, { maxConcurrentCalls: 3, tmpDir: './tmp' })
|
|
261
|
+
|
|
262
|
+
const auto = await voip.autoAnswer({
|
|
263
|
+
media: './song.mp3', // path, URL, playlist, { audio } / { video }, or (incoming) => media
|
|
264
|
+
delayMs: 3000, // ring time before answering
|
|
265
|
+
allow: ['947XXXXXXXX'], // only these callers are answered
|
|
266
|
+
onAnswer: (call, incoming) => console.log('answered', incoming.jid)
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
auto.stop()
|
|
270
|
+
````
|
|
271
|
+
|
|
272
|
+
| Option | Meaning |
|
|
273
|
+
|---|---|
|
|
274
|
+
| `media` | File, URL, playlist or a function. Leave out for a silent call |
|
|
275
|
+
| `resolution` | `'240p'` to `'1080p'` or `{ width, height, frameRate }` |
|
|
276
|
+
| `loop`, `autoEndCall`, `autoDowngrade` | Same as in `voip.call()` |
|
|
277
|
+
| `allow` / `deny` | Callers to answer or always reject |
|
|
278
|
+
| `unmatched` | Callers not in `allow`: `'ignore'` (default) or `'reject'` |
|
|
279
|
+
| `audioCalls`, `videoCalls` | Set one to `false` to reject that call type |
|
|
280
|
+
|
|
281
|
+
> Auto answering everyone can be abused if your number is public. Use `allow` or `deny`.
|
|
282
|
+
|
|
283
|
+
### Auto reject (anti call)
|
|
284
|
+
|
|
285
|
+
````javascript
|
|
286
|
+
await voip.autoReject({
|
|
287
|
+
allow: ['947XXXXXXXX'],
|
|
288
|
+
message: 'Please send a message, calls are off.'
|
|
289
|
+
})
|
|
290
|
+
````
|
|
291
|
+
|
|
292
|
+
### Start a call, playlist control and history
|
|
293
|
+
|
|
294
|
+
````javascript
|
|
295
|
+
const call = await voip.call('947XXXXXXXX', './song.mp3')
|
|
296
|
+
await call.enqueue('./next.mp3') // add to the end
|
|
297
|
+
await call.play('./now.mp3') // play right now
|
|
298
|
+
await call.skip() // next item
|
|
299
|
+
call.nowPlaying // { index, kind, source } or null
|
|
300
|
+
await call.hangup()
|
|
301
|
+
|
|
302
|
+
voip.history // last 100 calls (change with { historyLimit })
|
|
303
|
+
````
|
|
304
|
+
|
|
305
|
+
Video calls, multi-call (`callMany`), in-call controls and every call event are in [`docs/CALLS.md`](https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/docs/CALLS.md) and [`docs/FEATURES.md`](https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/docs/FEATURES.md).
|
|
306
|
+
|
|
307
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
308
|
+
|
|
309
|
+
## ๐ค AI Rich Messages
|
|
310
|
+
|
|
311
|
+
````javascript
|
|
312
|
+
await sock.aiRich()
|
|
313
|
+
.setTitle('Ai Rich Message')
|
|
314
|
+
.addText('Here is what I found:')
|
|
315
|
+
.addCode('javascript', `console.log('Hello World')`)
|
|
316
|
+
.addTable([
|
|
317
|
+
['Name', 'Score'],
|
|
318
|
+
['Alice', '90']
|
|
319
|
+
])
|
|
320
|
+
.addSuggest(['Continue', 'Cancel'])
|
|
321
|
+
.send(jid, { quoted: m })
|
|
322
|
+
````
|
|
323
|
+
|
|
324
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
325
|
+
|
|
326
|
+
## ๐๏ธ Session storage
|
|
327
|
+
|
|
328
|
+
All helpers return `{ state, saveCreds }`, so you can swap them freely.
|
|
329
|
+
|
|
330
|
+
````javascript
|
|
331
|
+
import {
|
|
332
|
+
useMultiFileAuthState,
|
|
333
|
+
useSingleFileAuthState,
|
|
334
|
+
useSqliteAuthState,
|
|
335
|
+
useMongoDBAuthState,
|
|
336
|
+
useKeyvAuthState
|
|
337
|
+
} from '@itznomo/ballieys'
|
|
338
|
+
|
|
339
|
+
const multi = await useMultiFileAuthState('./auth') // one file per key
|
|
340
|
+
const single = await useSingleFileAuthState('./session.json') // one file, flushed in batches
|
|
341
|
+
const sqlite = await useSqliteAuthState({ dbPath: './session.db' }) // SQLite, zero setup
|
|
342
|
+
const mongo = await useMongoDBAuthState({ url: 'mongodb://localhost:27017' }) // needs `npm i mongodb`
|
|
343
|
+
````
|
|
344
|
+
|
|
345
|
+
## โก Performance modes
|
|
346
|
+
|
|
347
|
+
````javascript
|
|
348
|
+
const sock = makeWASocket({
|
|
349
|
+
auth: state,
|
|
350
|
+
performanceMode: 'high' // 'balanced' (default) | 'high' | 'low-memory'
|
|
351
|
+
})
|
|
352
|
+
````
|
|
353
|
+
|
|
354
|
+
| Mode | Target |
|
|
355
|
+
|---|---|
|
|
356
|
+
| `'balanced'` | General bots. Safe defaults with group metadata caching and message deduplication |
|
|
357
|
+
| `'high'` | Ultra-fast response bots. Bigger caches and the lowest latency |
|
|
358
|
+
| `'low-memory'` | VPS and embedded setups (512 MB RAM or less) |
|
|
359
|
+
|
|
360
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
361
|
+
|
|
362
|
+
## ๐ค Bot commands
|
|
363
|
+
|
|
364
|
+
The example bot ships with **55 commands**. The default prefix is `.`
|
|
365
|
+
|
|
366
|
+
<details>
|
|
367
|
+
<summary><b>๐ Basic</b></summary>
|
|
368
|
+
|
|
369
|
+
| Command | What it does |
|
|
370
|
+
|---|---|
|
|
371
|
+
| `.menu` `.help` | Show every command |
|
|
372
|
+
| `.menulist` | Menu as a drop-down list |
|
|
373
|
+
| `.ping` | Check the bot is alive |
|
|
374
|
+
| `.alive` | Status with buttons |
|
|
375
|
+
| `.runtime` | How long the bot has been running |
|
|
376
|
+
| `.id` | Show chat and sender ids |
|
|
377
|
+
| `.owner` | Send the owner contact (email) |
|
|
378
|
+
|
|
379
|
+
</details>
|
|
380
|
+
|
|
381
|
+
<details>
|
|
382
|
+
<summary><b>๐ Buttons</b></summary>
|
|
383
|
+
|
|
384
|
+
| Command | What it does |
|
|
385
|
+
|---|---|
|
|
386
|
+
| `.buttons` | Quick reply, link, copy and call buttons |
|
|
387
|
+
| `.classic` | Classic reply buttons |
|
|
388
|
+
| `.list` | Drop-down list inside native flow |
|
|
389
|
+
| `.carousel` | Carousel with image cards |
|
|
390
|
+
| `.widget` | Widget with inputs and a button |
|
|
391
|
+
|
|
392
|
+
</details>
|
|
393
|
+
|
|
394
|
+
<details>
|
|
395
|
+
<summary><b>๐ผ๏ธ Media</b></summary>
|
|
396
|
+
|
|
397
|
+
| Command | What it does |
|
|
398
|
+
|---|---|
|
|
399
|
+
| `.image` `.video` `.gif` `.audio` | Send sample media |
|
|
400
|
+
| `.sticker` | Send a sticker |
|
|
401
|
+
| `.doc` | Send a document |
|
|
402
|
+
| `.viewonce` | Send a view once image |
|
|
403
|
+
| `.album` | Send an album |
|
|
404
|
+
| `.pp` | Profile picture of you, a reply or a mention |
|
|
405
|
+
|
|
406
|
+
</details>
|
|
407
|
+
|
|
408
|
+
<details>
|
|
409
|
+
<summary><b>๐ฒ Fun & AI Rich</b></summary>
|
|
410
|
+
|
|
411
|
+
| Command | What it does |
|
|
412
|
+
|---|---|
|
|
413
|
+
| `.poll` | Make a poll: `question \| option \| option` |
|
|
414
|
+
| `.event` | Event card that starts in one hour |
|
|
415
|
+
| `.location` | Send a location |
|
|
416
|
+
| `.react` | React to your message |
|
|
417
|
+
| `.dice` `.coin` | Roll a dice, flip a coin |
|
|
418
|
+
| `.aitable` | AI rich message with a table |
|
|
419
|
+
| `.aicode` | AI rich message with a code block |
|
|
420
|
+
|
|
421
|
+
</details>
|
|
422
|
+
|
|
423
|
+
<details>
|
|
424
|
+
<summary><b>๐ฅ Group & Group admin</b></summary>
|
|
425
|
+
|
|
426
|
+
| Command | What it does |
|
|
427
|
+
|---|---|
|
|
428
|
+
| `.groupinfo` | Group name, members and admins |
|
|
429
|
+
| `.tagall` | Mention everyone (admins, once a minute) |
|
|
430
|
+
| `.kick` `.add` | Remove or add a member (reply, @mention or number) |
|
|
431
|
+
| `.promote` `.demote` | Make or remove admin |
|
|
432
|
+
| `.link` `.revoke` | Get or reset the invite link |
|
|
433
|
+
| `.gname` `.gdesc` | Change group name or description |
|
|
434
|
+
| `.mute` `.unmute` | Only admins can send, or everyone |
|
|
435
|
+
| `.lock` `.unlock` | Only admins can edit info, or everyone |
|
|
436
|
+
|
|
437
|
+
The bot must be a group admin too.
|
|
438
|
+
|
|
439
|
+
</details>
|
|
440
|
+
|
|
441
|
+
<details>
|
|
442
|
+
<summary><b>๐ Calls</b></summary>
|
|
443
|
+
|
|
444
|
+
| Command | What it does |
|
|
445
|
+
|---|---|
|
|
446
|
+
| `.callme` | The bot calls you and plays music (private only) |
|
|
447
|
+
| `.calls` | Last 5 calls (owner only) |
|
|
448
|
+
| `.anticall on\|off` | Reject incoming calls (owner only) |
|
|
449
|
+
| `.autoanswer on [all]\|off` | Answer calls with music (owner only) |
|
|
450
|
+
|
|
451
|
+
</details>
|
|
452
|
+
|
|
453
|
+
<details>
|
|
454
|
+
<summary><b>๐ Owner</b></summary>
|
|
455
|
+
|
|
456
|
+
| Command | What it does |
|
|
457
|
+
|---|---|
|
|
458
|
+
| `.privacy` | Change privacy: lastseen, online, profile, status, read, groups |
|
|
459
|
+
| `.block` `.unblock` `.blocklist` | Manage blocked numbers |
|
|
460
|
+
| `.bio` `.botname` | Change the bot bio or profile name |
|
|
461
|
+
| `.theme` | Set the chat theme of this chat |
|
|
462
|
+
| `.leave` | Bot leaves this group |
|
|
463
|
+
|
|
464
|
+
</details>
|
|
465
|
+
|
|
466
|
+
Add, remove or rename commands in `Example/full-bot-commands.mjs`.
|
|
467
|
+
|
|
468
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
469
|
+
|
|
470
|
+
## ๐ More docs
|
|
471
|
+
|
|
472
|
+
[`BUTTONS.md`](https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/BUTTONS.md) ยท [`docs/CALLS.md`](https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/docs/CALLS.md) ยท [`docs/FEATURES.md`](https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/docs/FEATURES.md)
|
|
473
|
+
|
|
474
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
475
|
+
|
|
476
|
+
## โ ๏ธ Good to know
|
|
477
|
+
|
|
478
|
+
- Unofficial library. WhatsApp can change or block things on the server side, and accounts can get banned. Use a spare number for testing.
|
|
479
|
+
- Button and interactive rendering depends on the WhatsApp app version.
|
|
480
|
+
- Calls are the least tested part against the real WhatsApp servers.
|
|
481
|
+
- Do not use it for spam, bulk messaging or impersonation.
|
|
482
|
+
|
|
483
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
484
|
+
|
|
485
|
+
## ๐ Credits
|
|
486
|
+
|
|
487
|
+
### ๐ Author
|
|
488
|
+
|
|
489
|
+
<table>
|
|
490
|
+
<tr>
|
|
491
|
+
<td align="center">
|
|
492
|
+
<a href="https://github.com/NOMO-OFC">
|
|
493
|
+
<b>NOMO DEV</b>
|
|
494
|
+
</a>
|
|
495
|
+
<br/>
|
|
496
|
+
<sub><b>Anuhas Bandara</b></sub>
|
|
497
|
+
<br/>
|
|
498
|
+
<sub>Creator ยท Lead Developer ยท Maintainer</sub>
|
|
499
|
+
</td>
|
|
500
|
+
</tr>
|
|
501
|
+
</table>
|
|
502
|
+
|
|
503
|
+
| | |
|
|
504
|
+
|---|---|
|
|
505
|
+
| ๐งฉ **Package design** | Anuhas Bandara |
|
|
506
|
+
| ๐ **Buttons, lists and carousel helpers** | Anuhas Bandara |
|
|
507
|
+
| ๐ง **Command router** | Anuhas Bandara |
|
|
508
|
+
| ๐ค **Example bot (55 commands)** | Anuhas Bandara |
|
|
509
|
+
| ๐ **Call and auto answer integration** | Anuhas Bandara |
|
|
510
|
+
| ๐ **Docs and README** | Anuhas Bandara |
|
|
511
|
+
|
|
512
|
+
> โจ Made with โค๏ธ by **NOMO DEV** ยท **Anuhas Bandara** ๐ฑ๐ฐ
|
|
513
|
+
|
|
514
|
+
### ๐งฑ Built on
|
|
515
|
+
|
|
516
|
+
NOMO BAILEYS builds on open source work, all MIT licensed. Credit to the original authors is kept as the license requires.
|
|
517
|
+
|
|
518
|
+
| Project | Author |
|
|
519
|
+
|---|---|
|
|
520
|
+
| [Baileys](https://github.com/WhiskeySockets/Baileys) | [@WhiskeySockets](https://github.com/WhiskeySockets) and contributors |
|
|
521
|
+
| [@dnuzi/baileys](https://www.npmjs.com/package/@dnuzi/baileys) | [DanuZz](https://danuzz.movanest.xyz) |
|
|
522
|
+
| [wa-proto](https://github.com/wppconnect-team/wa-proto) (protocol buffers) | [WPP Connect](https://github.com/wppconnect-team) |
|
|
523
|
+
|
|
524
|
+
<p align="center"><img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/divider.svg" width="100%" height="10" alt=""/></p>
|
|
525
|
+
|
|
526
|
+
## ๐ License
|
|
527
|
+
|
|
528
|
+
MIT ยฉ 2026 **NOMO ยท Anuhas Bandara**. See [LICENSE](https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/LICENSE).
|
|
529
|
+
|
|
530
|
+
## ๐ Contact
|
|
531
|
+
|
|
532
|
+
**Anuhas Bandara (NOMO DEV)**
|
|
533
|
+
|
|
534
|
+
[Website](https://anuhas.site) ยท [Email](mailto:anuhazdev@gmail.com) ยท [GitHub](https://github.com/NOMO-OFC)
|
|
535
|
+
|
|
536
|
+
<div align="center">
|
|
537
|
+
|
|
538
|
+
<img src="https://cdn.jsdelivr.net/npm/@itznomo/ballieys@latest/assets/banner.svg" alt="" width="60%" />
|
|
539
|
+
|
|
540
|
+
<sub>Code. Automate. Repeat. โก</sub>
|
|
541
|
+
<br/>
|
|
542
|
+
<sub>ยฉ 2026 NOMO DEV ยท Anuhas Bandara</sub>
|
|
543
|
+
|
|
544
|
+
</div>
|
package/WAProto/@dnuzi
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|