its not work
TypeError: Cannot read property 'telegram' of undefined
can y help me
cron.schedule('* * * * *', (ctx) => {
console.log('in time schudle');
ctx.telegram.sendMessage('@mychannel','send this every min' ).then((result) => {
}).catch((err) => {
});
})
Use bot.telegram.sendMessage(...)
bot.hear('hi', (ctx) => {
// here ctx is defined
)}
But:
setInterval(function () {
// here is no ctx
)}
So as said @TiagoDanin use bot.telegram.sendMessage(id, text, extra)
@rozi98 context only available on update, you can use bot.telegram.sendMessage instead.
Most helpful comment
But:
So as said @TiagoDanin use
bot.telegram.sendMessage(id, text, extra)