projek1 / plugins /_anticall.js
devstok's picture
Upload folder using huggingface_hub
d8a4b7b verified
const { WAMessageStubType } = require('@adiwajshing/baileys')
var { format } = require('util');
let handler = m => m
const isNumber = x => typeof x === 'number' && !isNaN(x)
const delay = ms => isNumber(ms) && new Promise(resolve => setTimeout(function () {
clearTimeout(this)
resolve()
}, ms))
const setting = {
anticall: true
}
handler.all = async function (m) {
if (m.fromMe && m.isBaileys) return !0
let text;
if (!setting.anticall) return
if (m.messageStubType === (WAMessageStubType.CALL_MISSED_VOICE || WAMessageStubType.CALL_MISSED_VIDEO)) {
await this.reply(m.chat, '*Your number is blocked!*\nSee you next time👋', null)
await delay(1000)
await this.updateBlockStatus(m.chat, "block")
}
}
module.exports = handler