C
C
cepprice2018-10-11 16:42:11
Node.js
cepprice, 2018-10-11 16:42:11

Why do Telegram bot messages on Node.js come in random order?

There is a code

bot.sendMessage(id, msgs.breathingMSg) //1
        bot.sendMessage(id, msgs.focusMsg) //2
        bot.sendMessage(id, msgs.coldMsg) //3

Messages should arrive in this order: 1, 2, 3; but they come randomly. Is it really necessary to prescribe each
through .then() ?
bot.sendMessage(id, msgs.breathingMSg).then(() => {
            bot.sendMessage(id, msgs.focusMsg) //2})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2018-10-11
@cepprice

async function cepprice() {
  await bot.sendMessage(id, msgs.breathingMSg) //1
  await bot.sendMessage(id, msgs.focusMsg) //2
  await bot.sendMessage(id, msgs.coldMsg) //3
}
cepprice()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question