Made bot with node-telegram-bot-api. My bot has next function, that reacts to some word and with some chance sends a picture as reply, it must delete this message with picture in several seconds, but it doesnt.
Cant understand why doesnt bot delete this message after sending it.
if (lowCaseWords.includes('someWord')) {
const randomNumber = Math.random();
if (randomNumber < 0.1) {
bot.sendPhoto(chatId,
'https:...',
{
caption: `text`,
parse_mode: 'HTML'
})
.then((m) => {
setTimeout(() => {
bot.deleteMessage(chatId, m.message_id)
}, deleteTimer)
})
.catch(err => console.log(err))
}
}