Skip to content

Commit 9c4b8eb

Browse files
committed
docs(skill): autoRejectCall option, rejectCall method, auto-reject recipe
1 parent f5a41bc commit 9c4b8eb

6 files changed

Lines changed: 74 additions & 2 deletions

File tree

plugins/zaileys-official/skills/zaileys-assist/references/api.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ client.on('text', async (msg) => { if (msg.text === 'ping') await msg.reply('pon
6060
| `commandPrefix` | `string \| string[]` || enables `.command()`; empty/undefined ⇒ commands disabled |
6161
| `citation` | `CitationConfig` || `{authors?, banned?}`: each `string[] \| (jid)=>boolean\|Promise<boolean>` |
6262
| `ignoreMe` | `boolean` | `true` | drop self-authored inbound messages |
63+
| `autoRejectCall` | `boolean \| AutoRejectCallOptions` | `false` (off) | 🔗 **unofficial-only**. `true` = reject every incoming call. Object: `{ enabled?, allow?: string[] \| (jid)=>boolean\|Promise<boolean>, onReject?: (call)=>void\|Promise<void> }`. `allow` entries match full jid or digits; `allow`/`onReject` throws are logged, never fatal |
6364

6465
### Properties & lifecycle methods
6566

@@ -326,6 +327,13 @@ Programmatic `AIRichPart` union also supports `product`/`reels`/`post` with full
326327

327328
## Mutations
328329

330+
`client.rejectCall(call | callId, from?)``Promise<void>` — 🔗 **unofficial-only** (throws `UNSUPPORTED_ON_CLOUD` on cloud). Accepts the `call-incoming` payload OR raw `(callId, from)`. Throws `ZaileysAutomationError('NOT_CONNECTED')` if the socket is gone. Pair with the `autoRejectCall` option for hands-off rejecting.
331+
332+
```typescript
333+
client.on('call-incoming', (call) => client.rejectCall(call))
334+
```
335+
336+
329337
| method | signature | note |
330338
|---|---|---|
331339
| `client.edit(key)` | `EditBuilder` | chain `.text(s)` / `.image(src,opts?)` / `.video(src,opts?)` then `await``WAMessageKey` |

plugins/zaileys-official/skills/zaileys-assist/references/recipes.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,34 @@ await wa.cloud.flows.send(to, { flowId: 'FLOW1', cta: 'Isi form', bodyText: 'Boo
697697

698698
---
699699

700+
## 20. 🔗 Auto-reject incoming calls (unofficial only)
701+
702+
```typescript
703+
// hands-off: reject every call, tell the caller why, let the owner through
704+
const client = new Client({
705+
autoRejectCall: {
706+
enabled: true,
707+
allow: [process.env['OWNER']!], // full jid or bare digits both match
708+
onReject: async (call) => {
709+
await client.send(call.from).text('Maaf, nomor ini tidak menerima telepon 🙏')
710+
},
711+
},
712+
})
713+
714+
// shorthand — reject everything, no hook
715+
const client = new Client({ autoRejectCall: true })
716+
717+
// manual: decide per call (leave the option off)
718+
client.on('call-incoming', async (call) => {
719+
if (call.isVideo || call.isGroup) await client.rejectCall(call)
720+
})
721+
```
722+
723+
`allow` / `onReject` failures are caught + logged (never crash the client). `client.rejectCall()`
724+
throws on failure so you can handle it. Cloud provider has no calls → `UNSUPPORTED_ON_CLOUD`.
725+
726+
---
727+
700728
## Diagnostics
701729

702730
| Symptom | Cause | Fix |

plugins/zaileys-official/skills/zaileys-review/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ WHY: inbound is push + HMAC-verified; a body-parser corrupts the signature.
224224
presence, newsletter`. Connection: `connect, disconnect, qr, pairing-code, reconnecting,
225225
auth-exhausted, error`.
226226
- Client methods: `connect, disconnect, logout, send, edit, delete, react, forward,
227-
broadcast, scheduleAt, pin, unpin, setDisappearing, command, use, on, off`. `autoConnect`
227+
broadcast, scheduleAt, pin, unpin, setDisappearing, rejectCall, command, use, on, off`. `autoConnect`
228228
defaults `true`.
229229
- Typed modules: `client.profile` (setName/setStatus/setPicture/removePicture/getPicture/
230230
getStatus), `client.chat` (archive/unarchive/pin/unpin/mute/unmute/markRead/markUnread/star/

skills/zaileys-assist/references/api.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ client.on('text', async (msg) => { if (msg.text === 'ping') await msg.reply('pon
6060
| `commandPrefix` | `string \| string[]` || enables `.command()`; empty/undefined ⇒ commands disabled |
6161
| `citation` | `CitationConfig` || `{authors?, banned?}`: each `string[] \| (jid)=>boolean\|Promise<boolean>` |
6262
| `ignoreMe` | `boolean` | `true` | drop self-authored inbound messages |
63+
| `autoRejectCall` | `boolean \| AutoRejectCallOptions` | `false` (off) | 🔗 **unofficial-only**. `true` = reject every incoming call. Object: `{ enabled?, allow?: string[] \| (jid)=>boolean\|Promise<boolean>, onReject?: (call)=>void\|Promise<void> }`. `allow` entries match full jid or digits; `allow`/`onReject` throws are logged, never fatal |
6364

6465
### Properties & lifecycle methods
6566

@@ -326,6 +327,13 @@ Programmatic `AIRichPart` union also supports `product`/`reels`/`post` with full
326327

327328
## Mutations
328329

330+
`client.rejectCall(call | callId, from?)``Promise<void>` — 🔗 **unofficial-only** (throws `UNSUPPORTED_ON_CLOUD` on cloud). Accepts the `call-incoming` payload OR raw `(callId, from)`. Throws `ZaileysAutomationError('NOT_CONNECTED')` if the socket is gone. Pair with the `autoRejectCall` option for hands-off rejecting.
331+
332+
```typescript
333+
client.on('call-incoming', (call) => client.rejectCall(call))
334+
```
335+
336+
329337
| method | signature | note |
330338
|---|---|---|
331339
| `client.edit(key)` | `EditBuilder` | chain `.text(s)` / `.image(src,opts?)` / `.video(src,opts?)` then `await``WAMessageKey` |

skills/zaileys-assist/references/recipes.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,34 @@ await wa.cloud.flows.send(to, { flowId: 'FLOW1', cta: 'Isi form', bodyText: 'Boo
697697

698698
---
699699

700+
## 20. 🔗 Auto-reject incoming calls (unofficial only)
701+
702+
```typescript
703+
// hands-off: reject every call, tell the caller why, let the owner through
704+
const client = new Client({
705+
autoRejectCall: {
706+
enabled: true,
707+
allow: [process.env['OWNER']!], // full jid or bare digits both match
708+
onReject: async (call) => {
709+
await client.send(call.from).text('Maaf, nomor ini tidak menerima telepon 🙏')
710+
},
711+
},
712+
})
713+
714+
// shorthand — reject everything, no hook
715+
const client = new Client({ autoRejectCall: true })
716+
717+
// manual: decide per call (leave the option off)
718+
client.on('call-incoming', async (call) => {
719+
if (call.isVideo || call.isGroup) await client.rejectCall(call)
720+
})
721+
```
722+
723+
`allow` / `onReject` failures are caught + logged (never crash the client). `client.rejectCall()`
724+
throws on failure so you can handle it. Cloud provider has no calls → `UNSUPPORTED_ON_CLOUD`.
725+
726+
---
727+
700728
## Diagnostics
701729

702730
| Symptom | Cause | Fix |

skills/zaileys-review/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ WHY: inbound is push + HMAC-verified; a body-parser corrupts the signature.
224224
presence, newsletter`. Connection: `connect, disconnect, qr, pairing-code, reconnecting,
225225
auth-exhausted, error`.
226226
- Client methods: `connect, disconnect, logout, send, edit, delete, react, forward,
227-
broadcast, scheduleAt, pin, unpin, setDisappearing, command, use, on, off`. `autoConnect`
227+
broadcast, scheduleAt, pin, unpin, setDisappearing, rejectCall, command, use, on, off`. `autoConnect`
228228
defaults `true`.
229229
- Typed modules: `client.profile` (setName/setStatus/setPicture/removePicture/getPicture/
230230
getStatus), `client.chat` (archive/unarchive/pin/unpin/mute/unmute/markRead/markUnread/star/

0 commit comments

Comments
 (0)