N
N
Nameless Man2020-06-28 11:35:23
JavaScript
Nameless Man, 2020-06-28 11:35:23

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  
    };
});

For some reason this code does not work:
if(res.items[0].text.slice(0, 31) == `Человек успешно заразился вашей`) {
     console.log(`Заразили`)
};

There are no errors in the console.
The rest works great.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nameless Man, 2020-06-28
@Almas_Almuhametov

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 question

Ask a Question

731 491 924 answers to any question