Baileys icon indicating copy to clipboard operation
Baileys copied to clipboard

How to reject in coming call ?

Open officialdittaz opened this issue 2 years ago • 16 comments

Before adding this issue, make sure you do the following to make sure this is not a duplicate:

  1. Search through the repo's previous issues
  2. Read through the readme at least once
  3. Search the docs for the feature you're looking for

Just describe the feature/question

officialdittaz avatar Jul 22 '22 09:07 officialdittaz

Use event

ztfcode avatar Jul 22 '22 09:07 ztfcode

Use event

Are you sure ?

officialdittaz avatar Jul 22 '22 10:07 officialdittaz

sock.ev.on('call', json => { let { from } = json[2][0][1], action = json[2][0][0] switch (action) { case 'call': await itx.sendMessage(from, 'Anda diblock otomatis karena menelpon bot!', 'conversation') await sleep(500) await itx.blockUser(from, 'add') break default: break }})

ztfcode avatar Jul 22 '22 10:07 ztfcode

can you send anti call code

ME1SEGAWON avatar Jul 22 '22 10:07 ME1SEGAWON

can you send anti call code

sock.ev.on('call', json => { let { from } = json[2][0][1], action = json[2][0][0] switch (action) { case 'call': await itx.sendMessage(from, 'Anda diblock otomatis karena menelpon bot!', 'conversation') await sleep(500) await itx.blockUser(from, 'add') break default: break }})

ztfcode avatar Jul 23 '22 04:07 ztfcode

sock.ev.on('call', json => { let { from } = json[2][0][1], action = json[2][0][0] switch (action) { case 'call': await itx.sendMessage(from, 'Anda diblock otomatis karena menelpon bot!', 'conversation') await sleep(500) await itx.blockUser(from, 'add') break default: break }})

can you send anti call code

sock.ev.on('call', json => { let { from } = json[2][0][1], action = json[2][0][0] switch (action) { case 'call': await itx.sendMessage(from, 'Anda diblock otomatis karena menelpon bot!', 'conversation') await sleep(500) await itx.blockUser(from, 'add') break default: break }})

it's will block calling user! not reject call (incoming call still ringing)

MaznAbdullah avatar Jul 23 '22 05:07 MaznAbdullah

[]

ztfcode avatar Jul 23 '22 05:07 ztfcode

Let me explain you know baileys dont have ability to do that baileys cant reject oncalling just handling oncalling present

your wrong, baileys can do that :\

zennn08 avatar Jul 23 '22 08:07 zennn08

Let me explain you know baileys dont have ability to do that baileys cant reject oncalling just handling oncalling present

your wrong, baileys can do that :\

How do that

ztfcode avatar Jul 23 '22 21:07 ztfcode

This issue is stale because it has been open 6 days with no activity. Remove the stale label or comment or this will be closed in 2 days

github-actions[bot] avatar Jul 30 '22 03:07 github-actions[bot]

So please show me your code to implement this i just sharing as far i know because im new in baileys a few last month i have read issue that web whatsapp cant implement rejecting oncalling ^_^

ztfcode avatar Jul 30 '22 05:07 ztfcode

Hey there! 👋 I've already implemented the code to reject the call today I'll request a PR (Pull Request) so that you can use that function to reject the call easily.

RahulKasireddy avatar Jul 31 '22 01:07 RahulKasireddy

Hei!👋Saya sudah menerapkan kode untuk menolak panggilan hari ini saya akan meminta PR (Tarik Permintaan) sehingga Anda dapat menggunakan fungsi itu untuk menolak panggilan dengan mudah.

Ok thanks a lot ^_^

ztfcode avatar Jul 31 '22 03:07 ztfcode

how to update profile status you can use this code

conn.setStatus = async (status) => { return await conn.query({ tag: 'iq', attrs: { to: 's.whatsapp.net', type: 'set', xmlns: 'status', }, content: [ { tag: 'status', attrs: {}, content: Buffer.from(status, 'utf-8') } ] })

}

if you want to reject call you can use this code, maybe :v

conn.ws.on('CB:call', async (json) => { console.log(json) const callerId = json.content[0].attrs['call-creator'] const idCall = json.content[0].attrs['call-id'] const Id = json.attrs.id const T = json.attrs.t conn.sendNode({ tag: 'call', attrs: { from: '[email protected]', id: Id, t: T }, content: [ { tag: 'reject', attrs: { 'call-creator': callerId, 'call-id': idCall, count: '0' }, content: null } ] })

})

officialdittaz avatar Jul 31 '22 08:07 officialdittaz

how to update profile status you can use this code

conn.setStatus = async (status) => { return await conn.query({ tag: 'iq', attrs: { to: 's.whatsapp.net', type: 'set', xmlns: 'status', }, content: [ { tag: 'status', attrs: {}, content: Buffer.from(status, 'utf-8') } ] })

}

if you want to reject call you can use this code, maybe :v

conn.ws.on('CB:call', async (json) => { console.log(json) const callerId = json.content[0].attrs['call-creator'] const idCall = json.content[0].attrs['call-id'] const Id = json.attrs.id const T = json.attrs.t conn.sendNode({ tag: 'call', attrs: { from: '[email protected]', id: Id, t: T }, content: [ { tag: 'reject', attrs: { 'call-creator': callerId, 'call-id': idCall, count: '0' }, content: null } ] })

})

Thanks for the implement ^_^

ztfcode avatar Jul 31 '22 08:07 ztfcode

close the issue as it is resolved, also regarding @officialdittaz 's code, you should not statically set the number the node is sent from. I'd say get the number dynamically (sock.user.id on MD)

conn.ws.on('CB:call', async (json) => {
    console.log(json)
    const callerId = json.content[0].attrs['call-creator']
    const idCall = json.content[0].attrs['call-id']
    const Id = json.attrs.id
    const T = json.attrs.t
    conn.sendNode({
        tag: 'call',
        attrs: {
-            from: '[email protected]',
+            from: conn.user.id,
            id: Id,
            t: T
        },
        content: [{
            tag: 'reject',
            attrs: {
                'call-creator': callerId,
                'call-id': idCall,
                count: '0'
            },
            content: null
        }]
    })

})

PurpShell avatar Aug 01 '22 12:08 PurpShell

This issue is stale because it has been open 6 days with no activity. Remove the stale label or comment or this will be closed in 2 days

github-actions[bot] avatar Aug 10 '22 02:08 github-actions[bot]