miaw-core 1.9.1 → 1.12.0
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/.env.example +78 -0
- package/CHANGELOG.md +367 -0
- package/README.md +116 -26
- package/bin/miaw-cli.ts +100 -9
- package/dist/cli/commands/call.d.ts +16 -0
- package/dist/cli/commands/call.d.ts.map +1 -0
- package/dist/cli/commands/call.js +29 -0
- package/dist/cli/commands/call.js.map +1 -0
- package/dist/cli/commands/chat.d.ts +14 -0
- package/dist/cli/commands/chat.d.ts.map +1 -1
- package/dist/cli/commands/chat.js +48 -0
- package/dist/cli/commands/chat.js.map +1 -1
- package/dist/cli/commands/commands-index.d.ts +8 -5
- package/dist/cli/commands/commands-index.d.ts.map +1 -1
- package/dist/cli/commands/commands-index.js +12 -5
- package/dist/cli/commands/commands-index.js.map +1 -1
- package/dist/cli/commands/community.d.ts +28 -0
- package/dist/cli/commands/community.d.ts.map +1 -1
- package/dist/cli/commands/community.js +83 -0
- package/dist/cli/commands/community.js.map +1 -1
- package/dist/cli/commands/group.d.ts +49 -0
- package/dist/cli/commands/group.d.ts.map +1 -1
- package/dist/cli/commands/group.js +151 -0
- package/dist/cli/commands/group.js.map +1 -1
- package/dist/cli/commands/index.d.ts +15 -5
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +491 -46
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/instance.d.ts +46 -7
- package/dist/cli/commands/instance.d.ts.map +1 -1
- package/dist/cli/commands/instance.js +224 -34
- package/dist/cli/commands/instance.js.map +1 -1
- package/dist/cli/commands/privacy.d.ts +83 -0
- package/dist/cli/commands/privacy.d.ts.map +1 -0
- package/dist/cli/commands/privacy.js +167 -0
- package/dist/cli/commands/privacy.js.map +1 -0
- package/dist/cli/commands/proxy.d.ts +59 -0
- package/dist/cli/commands/proxy.d.ts.map +1 -0
- package/dist/cli/commands/proxy.js +418 -0
- package/dist/cli/commands/proxy.js.map +1 -0
- package/dist/cli/commands/send.d.ts +12 -0
- package/dist/cli/commands/send.d.ts.map +1 -1
- package/dist/cli/commands/send.js +44 -0
- package/dist/cli/commands/send.js.map +1 -1
- package/dist/cli/repl.d.ts +8 -6
- package/dist/cli/repl.d.ts.map +1 -1
- package/dist/cli/repl.js +501 -81
- package/dist/cli/repl.js.map +1 -1
- package/dist/cli/utils/client-cache.d.ts +8 -0
- package/dist/cli/utils/client-cache.d.ts.map +1 -1
- package/dist/cli/utils/client-cache.js +66 -7
- package/dist/cli/utils/client-cache.js.map +1 -1
- package/dist/cli/utils/instance-config.d.ts +89 -0
- package/dist/cli/utils/instance-config.d.ts.map +1 -0
- package/dist/cli/utils/instance-config.js +224 -0
- package/dist/cli/utils/instance-config.js.map +1 -0
- package/dist/cli/utils/instance-registry.d.ts +7 -0
- package/dist/cli/utils/instance-registry.d.ts.map +1 -1
- package/dist/cli/utils/instance-registry.js +2 -0
- package/dist/cli/utils/instance-registry.js.map +1 -1
- package/dist/cli/utils/parse-args.d.ts +41 -0
- package/dist/cli/utils/parse-args.d.ts.map +1 -0
- package/dist/cli/utils/parse-args.js +84 -0
- package/dist/cli/utils/parse-args.js.map +1 -0
- package/dist/cli/utils/proxy-config.d.ts +46 -0
- package/dist/cli/utils/proxy-config.d.ts.map +1 -0
- package/dist/cli/utils/proxy-config.js +93 -0
- package/dist/cli/utils/proxy-config.js.map +1 -0
- package/dist/cli/utils/proxy-resolver.d.ts +91 -0
- package/dist/cli/utils/proxy-resolver.d.ts.map +1 -0
- package/dist/cli/utils/proxy-resolver.js +180 -0
- package/dist/cli/utils/proxy-resolver.js.map +1 -0
- package/dist/cli/utils/session.d.ts +24 -1
- package/dist/cli/utils/session.d.ts.map +1 -1
- package/dist/cli/utils/session.js +5 -0
- package/dist/cli/utils/session.js.map +1 -1
- package/dist/client/MiawClient.d.ts +333 -9
- package/dist/client/MiawClient.d.ts.map +1 -1
- package/dist/client/MiawClient.js +874 -30
- package/dist/client/MiawClient.js.map +1 -1
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +234 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +22 -0
- package/dist/types/index.js.map +1 -1
- package/dist/utils/browser-presets.d.ts +51 -0
- package/dist/utils/browser-presets.d.ts.map +1 -0
- package/dist/utils/browser-presets.js +53 -0
- package/dist/utils/browser-presets.js.map +1 -0
- package/dist/utils/proxy-agent.d.ts +47 -11
- package/dist/utils/proxy-agent.d.ts.map +1 -1
- package/dist/utils/proxy-agent.js +65 -12
- package/dist/utils/proxy-agent.js.map +1 -1
- package/dist/utils/proxy-loader.d.ts +114 -0
- package/dist/utils/proxy-loader.d.ts.map +1 -0
- package/dist/utils/proxy-loader.js +379 -0
- package/dist/utils/proxy-loader.js.map +1 -0
- package/dist/utils/proxy-rotator.d.ts +132 -0
- package/dist/utils/proxy-rotator.d.ts.map +1 -0
- package/dist/utils/proxy-rotator.js +268 -0
- package/dist/utils/proxy-rotator.js.map +1 -0
- package/docs/API_STABILITY_REVIEW.md +10 -0
- package/docs/BAILEYS_MIGRATION_v7.md +10 -1
- package/docs/BAILEYS_VS_MIAW_COMPARISON.md +69 -48
- package/docs/CLI-ANALYSIS.md +10 -0
- package/docs/CLI.md +381 -4
- package/docs/CLI_INTEGRATION_TEST_PLAN.md +58 -24
- package/docs/CODE_REVIEW_REPORT.md +10 -0
- package/docs/DEFERRED_FEATURES.md +34 -38
- package/docs/DEPLOYMENT_INSTANCE_PROXY.md +168 -0
- package/docs/DEPLOYMENT_PROXY.md +151 -0
- package/docs/DEPLOYMENT_V1.12.0.md +163 -0
- package/docs/FOLLOW_UPS.md +320 -0
- package/docs/MIGRATION.md +147 -2
- package/docs/PROXY.md +706 -0
- package/docs/TEST_COVERAGE_ANALYSIS.md +29 -5
- package/docs/USAGE.md +340 -59
- package/package.json +8 -4
- package/sessions-cli/.cli_history +2 -0
- package/docs/PROXY_SUPPORT_PLAN.md +0 -1442
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Miaw Core abstracts away the complexity of Baileys, providing a clean, simple AP
|
|
|
10
10
|
|
|
11
11
|
| Aspect | Baileys (Direct) | Miaw Core |
|
|
12
12
|
| ---------------------- | ----------------------------- | ---------------------------------- |
|
|
13
|
-
| **Learning Curve** | Steep - 150+ methods to learn | Gentle -
|
|
13
|
+
| **Learning Curve** | Steep - 150+ methods to learn | Gentle - ~200 focused methods |
|
|
14
14
|
| **Setup Code** | 50-100 lines boilerplate | 10 lines to start |
|
|
15
15
|
| **Session Management** | Manual auth state handling | Automatic file-based persistence |
|
|
16
16
|
| **Reconnection** | DIY implementation | Built-in with configurable retries |
|
|
@@ -28,6 +28,10 @@ For a detailed comparison, see [Baileys vs Miaw Core Comparison](./docs/BAILEYS_
|
|
|
28
28
|
|
|
29
29
|
- **[CLI Guide](./docs/CLI.md)** - Command-line interface usage
|
|
30
30
|
- **[Usage Guide](./docs/USAGE.md)** - Complete guide for all current features
|
|
31
|
+
- **[Proxy Guide](./docs/PROXY.md)** - Proxies, proxy list files, and rotation strategies
|
|
32
|
+
- **[Proxy Deployment Notes](./docs/DEPLOYMENT_PROXY.md)** - Operational guidance for deploying with proxies
|
|
33
|
+
- **[Per-Instance Proxy Deployment](./docs/DEPLOYMENT_INSTANCE_PROXY.md)** - What v1.11.0 changes for operators
|
|
34
|
+
- **[LID Resolution](./docs/LID_RESOLUTION.md)** - Working with privacy-masked (`@lid`) JIDs
|
|
31
35
|
- **[Baileys Comparison](./docs/BAILEYS_VS_MIAW_COMPARISON.md)** - Feature comparison with raw Baileys
|
|
32
36
|
- **[Migration Guide](./docs/MIGRATION.md)** - Upgrading between versions
|
|
33
37
|
- **[Test Coverage](./docs/TEST_COVERAGE_ANALYSIS.md)** - API coverage analysis
|
|
@@ -41,6 +45,7 @@ For a detailed comparison, see [Baileys vs Miaw Core Comparison](./docs/BAILEYS_
|
|
|
41
45
|
- **Auto-Reconnection** - Handles connection drops and reconnects automatically
|
|
42
46
|
- **Session Management** - File-based session storage with automatic persistence
|
|
43
47
|
- **Multiple Instances** - Run multiple WhatsApp connections in a single process
|
|
48
|
+
- **Proxy Support** - HTTP/HTTPS/SOCKS proxies, proxy list files, and per-instance proxies (assigned or pinned)
|
|
44
49
|
- **TypeScript Support** - Full type definitions for excellent IDE experience
|
|
45
50
|
- **Event-Driven** - Easy-to-use event system for messages and connection states
|
|
46
51
|
- **Normalized Messages** - Simplified message format, no more complex Baileys structures
|
|
@@ -128,7 +133,7 @@ For more examples and detailed usage, see the [Usage Guide](./docs/USAGE.md).
|
|
|
128
133
|
|
|
129
134
|
### Manual Interactive Testing
|
|
130
135
|
|
|
131
|
-
|
|
136
|
+
Drive the API interactively against a live connection:
|
|
132
137
|
|
|
133
138
|
```bash
|
|
134
139
|
# Show available test groups
|
|
@@ -143,17 +148,34 @@ npm run test:manual business # Business features only
|
|
|
143
148
|
|
|
144
149
|
**Available test groups:**
|
|
145
150
|
|
|
146
|
-
| Group | Description
|
|
147
|
-
| ------------ |
|
|
148
|
-
| `core` | Connection, lifecycle
|
|
149
|
-
| `get` | Fetch contacts, groups, chats
|
|
150
|
-
| `messaging` | Send/receive, reactions, edit
|
|
151
|
-
| `contacts` | Check numbers, contact info
|
|
152
|
-
| `group` | Create, manage participants |
|
|
153
|
-
| `
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
151
|
+
| Group | Description |
|
|
152
|
+
| ------------ | ----------------------------------------------- |
|
|
153
|
+
| `core` | Connection, lifecycle |
|
|
154
|
+
| `get` | Fetch contacts, groups, chats |
|
|
155
|
+
| `messaging` | Send/receive, reactions, edit, pin, invites |
|
|
156
|
+
| `contacts` | Check numbers, contact info |
|
|
157
|
+
| `group` | Create, manage participants, admin settings |
|
|
158
|
+
| `community` | Communities, linked groups, admin, join requests|
|
|
159
|
+
| `profile` | Update picture, name, status |
|
|
160
|
+
| `business` | Labels, catalog (Business only) |
|
|
161
|
+
| `newsletter` | Channels, subscriptions |
|
|
162
|
+
| `ux` | Typing, presence, read receipts |
|
|
163
|
+
| `privacy` | Privacy settings, block / unblock |
|
|
164
|
+
| `calls` | Call event, reject, call links |
|
|
165
|
+
|
|
166
|
+
Run `npm run test:manual` with no argument for this list with a live entry count
|
|
167
|
+
per group — it is generated from the runner's own category map, so it cannot go
|
|
168
|
+
stale.
|
|
169
|
+
|
|
170
|
+
**Unattended mode:**
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
npm run test:manual:auto # every group, no prompts, non-zero exit on failure
|
|
174
|
+
npm run test:manual group -- --auto # one group
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Prompts resolve to their `.env.test` defaults. Entries needing a human are
|
|
178
|
+
skipped; add `--destructive` to include the ones that change real state.
|
|
157
179
|
|
|
158
180
|
**Features:**
|
|
159
181
|
|
|
@@ -161,25 +183,36 @@ npm run test:manual business # Business features only
|
|
|
161
183
|
- Tracks test results with pass/fail/skip status
|
|
162
184
|
- Generates summary report with timestamps
|
|
163
185
|
- Pre-loads test configuration from `.env.test`
|
|
164
|
-
|
|
165
|
-
|
|
186
|
+
- Warns when `.env.test` is configured in a way that silently invalidates
|
|
187
|
+
results (e.g. both contact numbers set to the bot's own number)
|
|
166
188
|
|
|
167
189
|
### Unit & Integration Tests
|
|
168
190
|
|
|
169
191
|
```bash
|
|
170
|
-
#
|
|
192
|
+
# Unit suites only - the fast gate (615 tests, no connection needed)
|
|
193
|
+
npm run test:unit
|
|
194
|
+
|
|
195
|
+
# Everything, including the live-connection suites
|
|
171
196
|
npm test
|
|
172
197
|
|
|
173
|
-
#
|
|
174
|
-
npm run test:
|
|
198
|
+
# CLI command tests against a real connection (13 files)
|
|
199
|
+
npm run test:cli
|
|
200
|
+
|
|
201
|
+
# Type-check src/ and tests/ together
|
|
202
|
+
npm run typecheck
|
|
175
203
|
|
|
176
|
-
#
|
|
204
|
+
# Watch mode / coverage
|
|
205
|
+
npm run test:watch
|
|
177
206
|
npm run test:coverage
|
|
178
207
|
```
|
|
179
208
|
|
|
180
|
-
|
|
209
|
+
> Jest runs serially (`maxWorkers: 1`): the live suites share one WhatsApp
|
|
210
|
+
> session, so a parallel run would have them fighting over it. For the same
|
|
211
|
+
> reason, never run two test commands at once.
|
|
181
212
|
|
|
182
|
-
|
|
213
|
+
## Current Capabilities (v1.12.0)
|
|
214
|
+
|
|
215
|
+
Built on **Baileys v7.0.0-rc14** - the latest WhatsApp Web protocol implementation.
|
|
183
216
|
|
|
184
217
|
### Core Features
|
|
185
218
|
|
|
@@ -193,6 +226,22 @@ Built on **Baileys v7.0.0-rc13** - the latest WhatsApp Web protocol implementati
|
|
|
193
226
|
- ✅ TypeScript support
|
|
194
227
|
- ✅ Error handling
|
|
195
228
|
|
|
229
|
+
### Networking
|
|
230
|
+
|
|
231
|
+
- ✅ HTTP / HTTPS / SOCKS4 / SOCKS5 proxies, per instance
|
|
232
|
+
- ✅ Per-instance proxy pins that persist — `miaw-cli instance set-proxy <id> ...`, then no flags needed
|
|
233
|
+
- ✅ `client.setProxy()` — stage a proxy for the next connect (never rotates a live session's IP)
|
|
234
|
+
- ✅ Proxy list files (TXT / JSON) with validation and hot reload
|
|
235
|
+
- ✅ Rotation strategies (round-robin, random, weighted, deterministic-per-instance)
|
|
236
|
+
- ✅ `miaw-cli proxy test` connectivity diagnostics — no WhatsApp connection needed
|
|
237
|
+
- ⚠️ SOCKS proxies: media *downloads* use a direct connection ([details](./docs/PROXY.md#️-socks-media-downloads-use-a-direct-connection))
|
|
238
|
+
|
|
239
|
+
### Connection Identity
|
|
240
|
+
|
|
241
|
+
- ✅ Configurable browser identity via `BrowserPresets` (macOS / Windows / Ubuntu / Android)
|
|
242
|
+
- ✅ Android identity — Baileys reports this is required to **receive view-once media** ([details](./docs/USAGE.md#receiving-view-once-messages-android-identity))
|
|
243
|
+
- ✅ Live WhatsApp Web version negotiation (avoids stale-version 428 rejections)
|
|
244
|
+
|
|
196
245
|
### Advanced Messaging
|
|
197
246
|
|
|
198
247
|
- ✅ Reply/quote messages
|
|
@@ -200,6 +249,10 @@ Built on **Baileys v7.0.0-rc13** - the latest WhatsApp Web protocol implementati
|
|
|
200
249
|
- ✅ Delete messages
|
|
201
250
|
- ✅ Message reactions
|
|
202
251
|
- ✅ Forward messages
|
|
252
|
+
- ✅ Location, contact cards, polls and stickers
|
|
253
|
+
- ✅ Group invite cards — `sendGroupInvite()`
|
|
254
|
+
- ✅ Pin / unpin a message in a chat — `pinMessage()` / `unpinMessage()`
|
|
255
|
+
- ✅ Disappearing messages per chat — `setChatEphemeral()`
|
|
203
256
|
|
|
204
257
|
### Group Management
|
|
205
258
|
|
|
@@ -208,6 +261,39 @@ Built on **Baileys v7.0.0-rc13** - the latest WhatsApp Web protocol implementati
|
|
|
208
261
|
- ✅ Promote/demote admins
|
|
209
262
|
- ✅ Group invite links
|
|
210
263
|
- ✅ Update group settings
|
|
264
|
+
- ✅ Announce-only and info-edit locks
|
|
265
|
+
- ✅ Member-add mode (admins only / all members)
|
|
266
|
+
- ✅ Join approval, plus listing / approving / rejecting join requests
|
|
267
|
+
- ✅ Group-wide disappearing messages
|
|
268
|
+
|
|
269
|
+
### Communities
|
|
270
|
+
|
|
271
|
+
- ✅ Create communities, link and unlink groups
|
|
272
|
+
- ✅ Community members: add, remove, promote, demote
|
|
273
|
+
- ✅ Community invite links
|
|
274
|
+
- ✅ The same admin surface as groups — announce, restrict, add-mode,
|
|
275
|
+
join approval, join requests, disappearing messages
|
|
276
|
+
|
|
277
|
+
### Privacy & Blocklist
|
|
278
|
+
|
|
279
|
+
- ✅ Read all privacy settings, including categories Baileys has no setter for
|
|
280
|
+
(preserved under `raw`)
|
|
281
|
+
- ✅ Eight setters — last seen, online, profile picture, status, read receipts,
|
|
282
|
+
group add, messages, calls
|
|
283
|
+
- ✅ Default disappearing mode for new chats, and link-preview control
|
|
284
|
+
- ✅ Block / unblock, list the blocklist, check whether a contact is blocked
|
|
285
|
+
|
|
286
|
+
### Calls
|
|
287
|
+
|
|
288
|
+
- ✅ `call` event for incoming calls (offer / accept / reject / timeout)
|
|
289
|
+
- ✅ Reject an incoming call — `rejectCall()`
|
|
290
|
+
- ✅ Create shareable call links — `createCallLink()`
|
|
291
|
+
|
|
292
|
+
### Chat Management
|
|
293
|
+
|
|
294
|
+
- ✅ Archive, pin, mute, mark read/unread
|
|
295
|
+
- ✅ Clear or delete a chat
|
|
296
|
+
- ✅ Star / unstar messages
|
|
211
297
|
|
|
212
298
|
### Profile Management
|
|
213
299
|
|
|
@@ -244,16 +330,20 @@ Miaw Core handles these Baileys complexities for you:
|
|
|
244
330
|
|
|
245
331
|
```text
|
|
246
332
|
miaw-core/
|
|
333
|
+
├── bin/
|
|
334
|
+
│ └── miaw-cli.ts # CLI entry point (one-shot + REPL)
|
|
247
335
|
├── src/
|
|
248
336
|
│ ├── client/ # Main MiawClient class
|
|
249
337
|
│ ├── handlers/ # Auth and message handlers
|
|
250
338
|
│ ├── types/ # TypeScript definitions
|
|
251
|
-
│ ├──
|
|
339
|
+
│ ├── constants/ # Shared constant tables
|
|
340
|
+
│ ├── utils/ # Proxy agents, rotation, browser presets
|
|
341
|
+
│ ├── cli/ # CLI subsystem (commands + utils)
|
|
252
342
|
│ └── index.ts # Public API exports
|
|
253
343
|
├── docs/ # Documentation
|
|
254
344
|
├── examples/ # Usage examples
|
|
255
|
-
├── tests/ # Unit and integration tests
|
|
256
|
-
└── README.md
|
|
345
|
+
├── tests/ # Unit, integration and CLI integration tests
|
|
346
|
+
└── README.md # This file
|
|
257
347
|
```
|
|
258
348
|
|
|
259
349
|
## Contributing
|
|
@@ -278,8 +368,8 @@ MIT
|
|
|
278
368
|
|
|
279
369
|
## Credits
|
|
280
370
|
|
|
281
|
-
Built on top of [@whiskeysockets/baileys](https://github.com/WhiskeySockets/Baileys) v7.0.0-
|
|
371
|
+
Built on top of [@whiskeysockets/baileys](https://github.com/WhiskeySockets/Baileys) v7.0.0-rc14
|
|
282
372
|
|
|
283
373
|
---
|
|
284
374
|
|
|
285
|
-
**Version:** 1.
|
|
375
|
+
**Version:** 1.12.0 | **Baileys:** 7.0.0-rc14 | **Status:** Stable | **Updated:** 2026-09-02
|
package/bin/miaw-cli.ts
CHANGED
|
@@ -17,6 +17,16 @@ import { runRepl } from "../src/cli/repl.js";
|
|
|
17
17
|
import { runCommand } from "../src/cli/commands/index.js";
|
|
18
18
|
import { initializeCLICleanup } from "../src/cli/utils/cleanup.js";
|
|
19
19
|
import { getErrorMessage } from "../src/utils/type-guards.js";
|
|
20
|
+
import {
|
|
21
|
+
configFromResolved,
|
|
22
|
+
describeProxySource,
|
|
23
|
+
resolveProxyForInstance,
|
|
24
|
+
type ProxyResolutionBase,
|
|
25
|
+
} from "../src/cli/utils/proxy-resolver.js";
|
|
26
|
+
import { maskProxyUrl } from "../src/utils/proxy-agent.js";
|
|
27
|
+
import {
|
|
28
|
+
parseProxyStrategy,
|
|
29
|
+
} from "../src/cli/utils/proxy-config.js";
|
|
20
30
|
|
|
21
31
|
// Initialize CLI cleanup handlers for graceful shutdown
|
|
22
32
|
initializeCLICleanup();
|
|
@@ -28,6 +38,16 @@ dotenv.config({ path: ".env.test" });
|
|
|
28
38
|
// Default configuration
|
|
29
39
|
const DEFAULT_INSTANCE_ID = process.env.MIAW_INSTANCE_ID || "default";
|
|
30
40
|
const DEFAULT_SESSION_PATH = process.env.MIAW_SESSION_PATH || "./sessions-cli";
|
|
41
|
+
// Proxy credentials belong in .env, not in shell history.
|
|
42
|
+
const DEFAULT_PROXY = process.env.MIAW_PROXY || undefined;
|
|
43
|
+
const DEFAULT_PROXY_FILE = process.env.MIAW_PROXY_FILE || undefined;
|
|
44
|
+
const DEFAULT_PROXY_STRATEGY_ENV = process.env.MIAW_PROXY_STRATEGY || undefined;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Global flags that never take a value. Listed explicitly because the parser is
|
|
48
|
+
* positional: without this an `--ip`-style flag consumes the command name.
|
|
49
|
+
*/
|
|
50
|
+
const BOOLEAN_FLAGS = new Set(["json", "debug", "help", "version", "ip", "from-file", "force"]);
|
|
31
51
|
|
|
32
52
|
/**
|
|
33
53
|
* Parse CLI arguments
|
|
@@ -44,6 +64,14 @@ function parseArgs(args: string[]): {
|
|
|
44
64
|
const arg = args[i];
|
|
45
65
|
if (arg.startsWith("--")) {
|
|
46
66
|
const flagName = arg.slice(2);
|
|
67
|
+
// Value-less flags must never swallow the next token. `--json instance ls`
|
|
68
|
+
// otherwise parsed as json="instance", leaving the command empty and
|
|
69
|
+
// reporting "Unknown command: ls" - even though --json is documented as a
|
|
70
|
+
// global option, i.e. valid before the command.
|
|
71
|
+
if (BOOLEAN_FLAGS.has(flagName)) {
|
|
72
|
+
flags[flagName] = true;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
47
75
|
const nextArg = args[i + 1];
|
|
48
76
|
if (nextArg && !nextArg.startsWith("--")) {
|
|
49
77
|
flags[flagName] = nextArg;
|
|
@@ -78,12 +106,16 @@ USAGE:
|
|
|
78
106
|
GLOBAL FLAGS:
|
|
79
107
|
--instance-id <id> Instance ID (default: "default")
|
|
80
108
|
--session-path <path> Session directory
|
|
81
|
-
--proxy <url> Proxy URL (http
|
|
109
|
+
--proxy <url> Proxy URL (http/https/socks4/socks4a/socks5/socks5h)
|
|
110
|
+
--proxy-file <path> Proxy list file (.txt one-per-line, or .json array)
|
|
111
|
+
--proxy-strategy <strategy> Pick from --proxy-file: round-robin | random |
|
|
112
|
+
weighted | deterministic (default: deterministic)
|
|
82
113
|
--json Output as JSON
|
|
83
114
|
--debug Enable verbose logging
|
|
84
115
|
|
|
85
116
|
COMMANDS:
|
|
86
|
-
instance Manage instances (ls, status, create, delete, connect, disconnect,
|
|
117
|
+
instance Manage instances (ls, status, create, delete, connect, disconnect,
|
|
118
|
+
logout, set-proxy, unset-proxy)
|
|
87
119
|
get Fetch data (profile, contacts, groups, chats, messages, labels)
|
|
88
120
|
load Load older messages from history
|
|
89
121
|
send Send messages (text, image, document)
|
|
@@ -93,6 +125,7 @@ COMMANDS:
|
|
|
93
125
|
profile Profile management (picture, name, status)
|
|
94
126
|
label Label management - WhatsApp Business (list, chats, add, chat)
|
|
95
127
|
catalog Catalog management - WhatsApp Business (list, collections, product)
|
|
128
|
+
proxy Inspect and test proxies (list, test, test-all) - no connection needed
|
|
96
129
|
|
|
97
130
|
COMMON OPTIONS:
|
|
98
131
|
--limit N Limit number of results
|
|
@@ -103,6 +136,16 @@ EXAMPLES:
|
|
|
103
136
|
miaw-cli send text 6281234567890 "Hello"
|
|
104
137
|
miaw-cli group participants add 120363xxx@g.us 628xxx
|
|
105
138
|
miaw-cli contact add 6281234567890 "John Doe"
|
|
139
|
+
miaw-cli proxy test socks5://proxy.example.com:1080
|
|
140
|
+
miaw-cli --instance-id bot-3 --proxy-file ./proxies.txt get groups
|
|
141
|
+
miaw-cli instance set-proxy bot-3 --label eu Pin a proxy, no credentials stored
|
|
142
|
+
miaw-cli --instance-id bot-3 get groups Uses bot-3's pinned proxy, no flags
|
|
143
|
+
|
|
144
|
+
PROXY PRECEDENCE (highest first):
|
|
145
|
+
--proxy / MIAW_PROXY > pinned in <session-path>/instances.json
|
|
146
|
+
> --proxy-file > direct
|
|
147
|
+
A pin applies on the instance's NEXT connect. Never change a live session's
|
|
148
|
+
egress IP - WhatsApp reads that as account takeover.
|
|
106
149
|
|
|
107
150
|
REPL MODE:
|
|
108
151
|
Run 'miaw-cli' without arguments to start interactive mode.
|
|
@@ -132,23 +175,69 @@ async function main() {
|
|
|
132
175
|
const jsonOutput = flags.json === true;
|
|
133
176
|
const debugMode = flags.debug === true;
|
|
134
177
|
|
|
135
|
-
// Extract proxy flag
|
|
136
|
-
const
|
|
178
|
+
// Extract proxy flags (CLI flag wins over the MIAW_PROXY* env fallbacks)
|
|
179
|
+
const explicitProxy = (flags.proxy as string | undefined) || DEFAULT_PROXY;
|
|
180
|
+
const proxyFile = (flags["proxy-file"] as string | undefined) || DEFAULT_PROXY_FILE;
|
|
137
181
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
182
|
+
let proxyStrategy;
|
|
183
|
+
try {
|
|
184
|
+
proxyStrategy = parseProxyStrategy(
|
|
185
|
+
(flags["proxy-strategy"] as string | undefined) || DEFAULT_PROXY_STRATEGY_ENV
|
|
186
|
+
);
|
|
187
|
+
} catch (error: unknown) {
|
|
188
|
+
console.error(`❌ ${getErrorMessage(error)}`);
|
|
189
|
+
process.exit(1);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Precedence lives in one place - see src/cli/utils/proxy-resolver.ts:
|
|
193
|
+
// --proxy > pin in instances.json > --proxy-file > direct
|
|
194
|
+
// Selection is keyed on this instanceId, and commands targeting a *different*
|
|
195
|
+
// instance re-resolve rather than reusing what the process started with.
|
|
196
|
+
const proxyBase: ProxyResolutionBase = {
|
|
141
197
|
sessionPath,
|
|
142
198
|
debug: debugMode,
|
|
143
|
-
...(
|
|
199
|
+
...(explicitProxy && { explicitProxy }),
|
|
200
|
+
...(proxyFile && { proxyFile }),
|
|
201
|
+
proxyStrategy,
|
|
144
202
|
};
|
|
145
203
|
|
|
204
|
+
// A failure here is reported but does NOT exit. A bad pin would otherwise
|
|
205
|
+
// lock the operator out of `instance unset-proxy` and `instance ls` - the
|
|
206
|
+
// commands that repair it. The config instead carries `proxyError`, and
|
|
207
|
+
// createClient() refuses to build a client, so nothing connects direct.
|
|
208
|
+
let clientConfig;
|
|
209
|
+
let resolvedProxy;
|
|
210
|
+
try {
|
|
211
|
+
// Resolve once, then build the config from that result: resolving twice
|
|
212
|
+
// would print every override warning twice.
|
|
213
|
+
resolvedProxy = await resolveProxyForInstance(proxyBase, instanceId);
|
|
214
|
+
clientConfig = configFromResolved(proxyBase, instanceId, resolvedProxy);
|
|
215
|
+
} catch (error: unknown) {
|
|
216
|
+
const reason = getErrorMessage(error);
|
|
217
|
+
console.error(`❌ ${reason}`);
|
|
218
|
+
console.error(
|
|
219
|
+
` Commands needing a connection will refuse until this is fixed; ` +
|
|
220
|
+
`"instance unset-proxy ${instanceId}" removes the pin.`
|
|
221
|
+
);
|
|
222
|
+
resolvedProxy = { source: "none" as const };
|
|
223
|
+
clientConfig = {
|
|
224
|
+
...configFromResolved(proxyBase, instanceId, resolvedProxy),
|
|
225
|
+
proxyError: reason,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const proxyUrl = clientConfig.proxy;
|
|
230
|
+
|
|
146
231
|
// No command provided - start REPL
|
|
147
232
|
if (!command) {
|
|
148
233
|
console.log(`\n🚀 Starting miaw-cli REPL...`);
|
|
149
234
|
console.log(`📂 Instance: ${instanceId}`);
|
|
150
235
|
console.log(`📂 Session: ${sessionPath}`);
|
|
151
|
-
if (proxyUrl)
|
|
236
|
+
if (proxyUrl) {
|
|
237
|
+
console.log(
|
|
238
|
+
`🌐 Proxy: ${maskProxyUrl(proxyUrl)} (${describeProxySource(resolvedProxy.source)})`
|
|
239
|
+
);
|
|
240
|
+
}
|
|
152
241
|
console.log(`🔧 Debug: ${debugMode ? "ON" : "OFF"}\n`);
|
|
153
242
|
|
|
154
243
|
try {
|
|
@@ -166,6 +255,8 @@ async function main() {
|
|
|
166
255
|
clientConfig,
|
|
167
256
|
jsonOutput,
|
|
168
257
|
flags,
|
|
258
|
+
...(proxyFile && { proxyFile }),
|
|
259
|
+
proxyStrategy,
|
|
169
260
|
});
|
|
170
261
|
|
|
171
262
|
if (!success) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Call Commands (v1.12.0)
|
|
3
|
+
*
|
|
4
|
+
* Create shareable call links. Rejecting a call is an event-driven operation —
|
|
5
|
+
* it only works while a call is ringing — so it belongs in a bot's `call`
|
|
6
|
+
* handler rather than on the CLI.
|
|
7
|
+
*/
|
|
8
|
+
import { MiawClient } from "../../index.js";
|
|
9
|
+
/**
|
|
10
|
+
* Create a shareable call link
|
|
11
|
+
*/
|
|
12
|
+
export declare function cmdCallLink(client: MiawClient, args: {
|
|
13
|
+
type: "audio" | "video";
|
|
14
|
+
startTime?: number;
|
|
15
|
+
}): Promise<boolean>;
|
|
16
|
+
//# sourceMappingURL=call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/call.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI5C;;GAEG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE;IAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACpD,OAAO,CAAC,OAAO,CAAC,CAmBlB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Call Commands (v1.12.0)
|
|
3
|
+
*
|
|
4
|
+
* Create shareable call links. Rejecting a call is an event-driven operation —
|
|
5
|
+
* it only works while a call is ringing — so it belongs in a bot's `call`
|
|
6
|
+
* handler rather than on the CLI.
|
|
7
|
+
*/
|
|
8
|
+
import { ensureConnected } from "../utils/session.js";
|
|
9
|
+
import { formatMessage } from "../utils/formatter.js";
|
|
10
|
+
/**
|
|
11
|
+
* Create a shareable call link
|
|
12
|
+
*/
|
|
13
|
+
export async function cmdCallLink(client, args) {
|
|
14
|
+
const conn = await ensureConnected(client);
|
|
15
|
+
if (!conn.success) {
|
|
16
|
+
console.log(`❌ Not connected: ${conn.reason}`);
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
console.log(`🔗 Creating ${args.type} call link...`);
|
|
20
|
+
const link = await client.createCallLink(args.type, args.startTime);
|
|
21
|
+
if (!link) {
|
|
22
|
+
console.log(formatMessage(false, "Failed to create call link"));
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
console.log(formatMessage(true, "Call link created"));
|
|
26
|
+
console.log(`\n${link}\n`);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=call.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.js","sourceRoot":"","sources":["../../../src/cli/commands/call.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAkB,EAClB,IAAqD;IAErD,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,IAAI,eAAe,CAAC,CAAC;IAErD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAEpE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC,CAAC;QAChE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Archive, pin, mute, mark read/unread, clear, and delete chats via chatModify.
|
|
5
5
|
*/
|
|
6
6
|
import { MiawClient } from "../../index.js";
|
|
7
|
+
import type { PinDurationValue } from "../../types/index.js";
|
|
7
8
|
export declare const cmdChatArchive: (client: MiawClient, args: {
|
|
8
9
|
jid: string;
|
|
9
10
|
}) => Promise<boolean>;
|
|
@@ -35,4 +36,17 @@ export declare const cmdChatClear: (client: MiawClient, args: {
|
|
|
35
36
|
export declare const cmdChatDelete: (client: MiawClient, args: {
|
|
36
37
|
jid: string;
|
|
37
38
|
}) => Promise<boolean>;
|
|
39
|
+
export declare const cmdChatEphemeral: (client: MiawClient, args: {
|
|
40
|
+
jid: string;
|
|
41
|
+
seconds: number;
|
|
42
|
+
}) => Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Pin or unpin a message in a chat
|
|
45
|
+
*/
|
|
46
|
+
export declare function cmdChatPinMessage(client: MiawClient, args: {
|
|
47
|
+
jid: string;
|
|
48
|
+
messageId: string;
|
|
49
|
+
pin: boolean;
|
|
50
|
+
duration?: PinDurationValue;
|
|
51
|
+
}): Promise<boolean>;
|
|
38
52
|
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/chat.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/chat.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAO,KAAK,EAAe,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA0B1E,eAAO,MAAM,cAAc,GAAI,QAAQ,UAAU,EAAE,MAAM;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,qBACM,CAAC;AAE/E,eAAO,MAAM,gBAAgB,GAAI,QAAQ,UAAU,EAAE,MAAM;IAAE,GAAG,EAAE,MAAM,CAAA;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gB,CAAA;CAAE,GAClF,OAAO,CAAC,OAAO,CAAC,CAwBlB"}
|
|
@@ -31,4 +31,52 @@ export const cmdChatRead = (client, args) => runChatOp(client, args.jid, "Markin
|
|
|
31
31
|
export const cmdChatUnread = (client, args) => runChatOp(client, args.jid, "Marking unread", () => client.markChatUnread(args.jid));
|
|
32
32
|
export const cmdChatClear = (client, args) => runChatOp(client, args.jid, "Clearing", () => client.clearChat(args.jid));
|
|
33
33
|
export const cmdChatDelete = (client, args) => runChatOp(client, args.jid, "Deleting", () => client.deleteChat(args.jid));
|
|
34
|
+
export const cmdChatEphemeral = (client, args) => runChatOp(client, args.jid, args.seconds === 0
|
|
35
|
+
? "Disabling disappearing messages for"
|
|
36
|
+
: `Setting ${args.seconds}s disappearing messages for`, () => client.setChatEphemeral(args.jid, args.seconds));
|
|
37
|
+
/**
|
|
38
|
+
* Look up a message in a chat's store by id.
|
|
39
|
+
*
|
|
40
|
+
* Pinning needs the raw Baileys key, which only lives on messages miaw-core has
|
|
41
|
+
* actually seen — the same constraint `media download` works under.
|
|
42
|
+
*/
|
|
43
|
+
async function findMessage(client, jid, messageId) {
|
|
44
|
+
const fetched = await client.getChatMessages(jid);
|
|
45
|
+
if (!fetched.success || !fetched.messages) {
|
|
46
|
+
console.log(`❌ Failed to fetch messages from ${jid}`);
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const message = fetched.messages.find((m) => m.id === messageId);
|
|
50
|
+
if (!message) {
|
|
51
|
+
console.log(`❌ Message not found: ${messageId}`);
|
|
52
|
+
console.log(` Tip: Use 'get messages ${jid}' to see available messages`);
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
if (!message.raw) {
|
|
56
|
+
console.log("❌ Message does not contain the raw data needed to pin it");
|
|
57
|
+
console.log(" Note: only messages this session has seen carry it");
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return message;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Pin or unpin a message in a chat
|
|
64
|
+
*/
|
|
65
|
+
export async function cmdChatPinMessage(client, args) {
|
|
66
|
+
const conn = await ensureConnected(client);
|
|
67
|
+
if (!conn.success) {
|
|
68
|
+
console.log(`❌ Not connected: ${conn.reason}`);
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
const message = await findMessage(client, args.jid, args.messageId);
|
|
72
|
+
if (!message)
|
|
73
|
+
return false;
|
|
74
|
+
const result = args.pin
|
|
75
|
+
? await client.pinMessage(message, args.duration)
|
|
76
|
+
: await client.unpinMessage(message);
|
|
77
|
+
console.log(formatMessage(result.success, result.success
|
|
78
|
+
? `Message ${args.pin ? "pinned" : "unpinned"}`
|
|
79
|
+
: `Failed to ${args.pin ? "pin" : "unpin"} message`, result.error));
|
|
80
|
+
return result.success;
|
|
81
|
+
}
|
|
34
82
|
//# sourceMappingURL=chat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/cli/commands/chat.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/cli/commands/chat.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,6DAA6D;AAC7D,KAAK,UAAU,SAAS,CACtB,MAAkB,EAClB,GAAW,EACX,MAAc,EACd,EAAuD;IAEvD,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC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M,CAAC,OAAO,CAAC;AACxB,CAAC"}
|
|
@@ -3,18 +3,21 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Exports all command handlers for the CLI
|
|
5
5
|
*/
|
|
6
|
-
export { cmdInstanceList, cmdInstanceStatus, cmdInstanceCreate, cmdInstanceDelete, cmdInstanceConnect, cmdInstanceDisconnect, cmdInstanceLogout, } from "./instance.js";
|
|
6
|
+
export { cmdInstanceList, cmdInstanceStatus, cmdInstanceCreate, cmdInstanceDelete, cmdInstanceConnect, cmdInstanceDisconnect, cmdInstanceLogout, cmdInstanceSetProxy, cmdInstanceUnsetProxy, } from "./instance.js";
|
|
7
7
|
export { cmdGetProfile, cmdGetContacts, cmdGetGroups, cmdGetChats, cmdGetMessages, cmdLoadMoreMessages, cmdGetLabels, } from "./get.js";
|
|
8
|
-
export { cmdSendText, cmdSendImage, cmdSendDocument, cmdSendVideo, cmdSendAudio, cmdSendLocation, cmdSendContact, cmdSendPoll, cmdSendSticker, } from "./send.js";
|
|
9
|
-
export { cmdChatArchive, cmdChatUnarchive, cmdChatPin, cmdChatUnpin, cmdChatMute, cmdChatUnmute, cmdChatRead, cmdChatUnread, cmdChatClear, cmdChatDelete, } from "./chat.js";
|
|
8
|
+
export { cmdSendText, cmdSendImage, cmdSendDocument, cmdSendVideo, cmdSendAudio, cmdSendLocation, cmdSendContact, cmdSendPoll, cmdSendSticker, cmdSendGroupInvite, } from "./send.js";
|
|
9
|
+
export { cmdChatArchive, cmdChatUnarchive, cmdChatPin, cmdChatUnpin, cmdChatEphemeral, cmdChatPinMessage, cmdChatMute, cmdChatUnmute, cmdChatRead, cmdChatUnread, cmdChatClear, cmdChatDelete, } from "./chat.js";
|
|
10
10
|
export { cmdStatusText, cmdStatusImage, cmdStatusVideo } from "./status.js";
|
|
11
11
|
export { cmdBusinessProfile, cmdBusinessCoverSet, cmdBusinessCoverRemove, } from "./business.js";
|
|
12
|
-
export { cmdCommunityList, cmdCommunityInfo, cmdCommunityCreate, cmdCommunityLeave, cmdCommunityNameSet, cmdCommunityDescriptionSet, cmdCommunityLinked, cmdCommunityLink, cmdCommunityUnlink, cmdCommunityGroupCreate, cmdCommunityMembers, cmdCommunityMembersAdd, cmdCommunityMembersRemove, cmdCommunityMembersPromote, cmdCommunityMembersDemote, cmdCommunityInviteLink, cmdCommunityInviteRevoke, cmdCommunityInviteAccept, cmdCommunityInviteInfo, } from "./community.js";
|
|
12
|
+
export { cmdCommunityList, cmdCommunityInfo, cmdCommunityCreate, cmdCommunityLeave, cmdCommunityNameSet, cmdCommunityDescriptionSet, cmdCommunityLinked, cmdCommunityLink, cmdCommunityUnlink, cmdCommunityGroupCreate, cmdCommunityMembers, cmdCommunityMembersAdd, cmdCommunityMembersRemove, cmdCommunityMembersPromote, cmdCommunityMembersDemote, cmdCommunityInviteLink, cmdCommunityInviteRevoke, cmdCommunityInviteAccept, cmdCommunityInviteInfo, cmdCommunityAnnounce, cmdCommunityRestrict, cmdCommunityAddMode, cmdCommunityApprovalMode, cmdCommunityEphemeral, cmdCommunityRequestsList, cmdCommunityRequestsDecide, } from "./community.js";
|
|
13
13
|
export { cmdMediaDownload } from "./media.js";
|
|
14
|
-
export { cmdGroupList, cmdGroupInfo, cmdGroupParticipants, cmdGroupInviteLink, cmdGroupCreate, cmdGroupLeave, cmdGroupInviteAccept, cmdGroupInviteRevoke, cmdGroupInviteInfo, cmdGroupParticipantsAdd, cmdGroupParticipantsRemove, cmdGroupParticipantsPromote, cmdGroupParticipantsDemote, cmdGroupNameSet, cmdGroupDescriptionSet, cmdGroupPictureSet, } from "./group.js";
|
|
14
|
+
export { cmdGroupList, cmdGroupInfo, cmdGroupParticipants, cmdGroupInviteLink, cmdGroupCreate, cmdGroupLeave, cmdGroupInviteAccept, cmdGroupInviteRevoke, cmdGroupInviteInfo, cmdGroupParticipantsAdd, cmdGroupParticipantsRemove, cmdGroupParticipantsPromote, cmdGroupParticipantsDemote, cmdGroupNameSet, cmdGroupDescriptionSet, cmdGroupPictureSet, cmdGroupAnnounce, cmdGroupRestrict, cmdGroupAddMode, cmdGroupApprovalMode, cmdGroupEphemeral, cmdGroupRequestsList, cmdGroupRequestsDecide, } from "./group.js";
|
|
15
15
|
export { cmdCheck, } from "./misc.js";
|
|
16
|
+
export { cmdProxyList, cmdProxyTest, cmdProxyTestAll, } from "./proxy.js";
|
|
16
17
|
export { cmdContactList, cmdContactInfo, cmdContactBusiness, cmdContactPicture, cmdContactAdd, cmdContactRemove, } from "./contact.js";
|
|
17
18
|
export { cmdProfilePictureSet, cmdProfilePictureRemove, cmdProfileNameSet, cmdProfileStatusSet, } from "./profile.js";
|
|
18
19
|
export { cmdLabelAdd, cmdLabelChats, cmdLabelChatAdd, cmdLabelChatRemove, } from "./label.js";
|
|
19
20
|
export { cmdCatalogList, cmdCatalogCollections, cmdCatalogProductCreate, cmdCatalogProductUpdate, cmdCatalogProductDelete, } from "./catalog.js";
|
|
21
|
+
export { cmdPrivacyShow, cmdPrivacySet, cmdPrivacyDisappearing, cmdPrivacyLinkPreviews, cmdBlockList, cmdBlockSet, PRIVACY_SETTINGS, } from "./privacy.js";
|
|
22
|
+
export { cmdCallLink } from "./call.js";
|
|
20
23
|
//# sourceMappingURL=commands-index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands-index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/commands-index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"commands-index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/commands-index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAq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