Answer the question
In order to leave comments, you need to log in
What to do if this piece of code does not work?
Hello! I have this piece of code:
updates.startPolling();
updates.on('message', async (message) => {
if(message.text.slice(0, 21) == `Заражаем человека под`) {
await sleep(7000)
user.api.messages.getHistory({
count: 1,
peer_id: тут ид группы, //тут должен был быть ид группы с минусом, но я специально убрал отсюда для вопроса в хабре
v: 5.123
}).then((res) => {
console.log(`${res.items[0].text.slice(0, 31)}`);
if(res.items[0].text.slice(0, 31) == `Человек успешно заразился вашей`) {
console.log(`Заразили`)
};
});
return
};
});
if(res.items[0].text.slice(0, 31) == `Человек успешно заразился вашей`) {
console.log(`Заразили`)
};
Answer the question
In order to leave comments, you need to log in
Resolved the issue. The bot just changed a few letters to Latin. Thanks to Aetae, I found out what was going on. Many thanks to him.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question