#How to block a number?

11 messages · Page 1 of 1 (latest)

meager tangle
#

Hello, is there any way to block a number that is flooding the bot?

last moon
#

You can also add a number on a blacklist and ignore the list

restive radish
#

You need to create an record like which number sent how many message in a day and block it on the basis of it or adding it in an ignore list.

Blocking works like this:

        //get contact
        const contact = await msg.getContact();
        //block contact
        await contact.block();
meager tangle
#

Something like if(msg.body === '!blocknumber '){ let number = msg.body.slice(16); const contact = await client.getContactById(number); await contact.block(); }

restive radish
#

i mean the full command you used

meager tangle
restive radish
#

you need to make some changes, i made a code that may help you

      if(msg.body.startsWith('!blocknumber')) {
            //change msg.body to array
            var arr = msg.body.split(" ");
            //get the number
            var number = arr[1];
            const contact = await client.getContactById(number);
            await contact.block();
        }

this will work for you. Make sure you send number correctly.

restive radish