Baileys
Baileys copied to clipboard
How to reject in coming call ?
Before adding this issue, make sure you do the following to make sure this is not a duplicate:
- Search through the repo's previous issues
- Read through the readme at least once
- Search the docs for the feature you're looking for
Just describe the feature/question
Use event
Use event
Are you sure ?
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
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 }})
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)
[]
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 :\
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
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
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 ^_^
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.
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 ^_^
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 } ] })
})
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 ^_^
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
}]
})
})
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