SlavyanDesu / BocchiBot

BocchiBot is a multipurpose WhatsApp bot using wa-automate-nodejs library!
MIT License
317 stars 412 forks source link

scheduled message #436

Closed salsawij closed 2 years ago

salsawij commented 2 years ago

is scheduled message possible? what to use to make this work

github-actions[bot] commented 2 years ago

Hello! Thanks for submiting the issue, we will respond to you ASAP.

ohsyme commented 2 years ago

is scheduled message possible? what to use to make this work

use node-cron npm

salsawij commented 2 years ago

var cron = require('node-cron'); async function start() { cron.schedule('10 ', () => { await conn.sendMessage(msg.from, "Hi sayang"); } start(); )}; start();

i tried this, but it doesn't seem to be working, i'm not sure where I wrote it wrong

ohsyme commented 2 years ago

async function start() {

wait what is that baileys????????

salsawij commented 2 years ago

yes, does it not work on baileys?

ohsyme commented 2 years ago

yes

bocchi is open wa lmfao since when baileys

salsawij commented 2 years ago

well, a friend of mine told me that the code is pretty similar, so he told me to use bocchi as a reference

ohsyme commented 2 years ago

Author

no . they so different

salsawij commented 2 years ago

so the scheduled message code can't be implemented in baileys?

ohsyme commented 2 years ago

so the scheduled message code can't be implemented in baileys?

u still can in baileys there is m.from = m.from ( group id ) try get manual group id use console log

salsawij commented 2 years ago

what do i do then? is the code below usable or not? msg.from is simply from in openwa

ohsyme commented 2 years ago

what do i do then? is the code below usable or not?

var cron = require('node-cron'); async function start() { cron.schedule('10 ', () => { await conn.sendMessage('group id put here', "Hi sayang"); } )}; start();

salsawij commented 2 years ago

ohh alright, thank you!! I've been using openwa for 1 to 2 weeks, but the it's very heavy in size. So i chose to use baileys since then openwa is easier than baileys tbh

ohsyme commented 2 years ago

what do i do then? is the code below usable or not?

var cron = require('node-cron'); async function start() { cron.schedule('10 ', () => { await conn.sendMessage('group id put here', "Hi sayang"); } )}; start();

image group id must be like this ( same open wa and baileys )

ohsyme commented 2 years ago

ohh alright, thank you!! I've been using openwa for 1 to 2 weeks, but the it's very heavy in size. So i chose to use baileys since then openwa is easier than baileys tbh

if you need help just discord me ohsyme#8175

ohsyme commented 2 years ago

ohh alright, thank you!! I've been using openwa for 1 to 2 weeks, but the it's very heavy in size. So i chose to use baileys since then openwa is easier than baileys tbh

var cron = require('node-cron');

  var task = cron.schedule('*/1 * * * *', async () =>  {
    console.log('will execute every minute until stopped');
task.stop(); 

}, {
    // sisanya basic crontab ada di google
    // https://nodecron.com/docs/
    // node cron bsa ngikutin dari pc lu

    // kalo scheduled dibawah ini gw setting biar dia ngikutin jam indonesia kalo dibuat false dia jadi ngikutin time rdp lu
    //semua tentang cron ada di google ok

    // https://crontab.guru

    // Enable scheduled option
    scheduled: true,
    // Define china timezone
    timezone: 'Asia/Jakarta',
});