I
I
Ivan2021-12-14 20:55:13
JavaScript
Ivan, 2021-12-14 20:55:13

Why doesn't await work in a function?

Hello! Please tell me why await does not work in a function and how to fix it.
Sometimes stopNext is executed later than search.
I read something about promises, but I have no idea how to do it.

module.exports = async function (bot, message) {
    if(message.user.partner) await stopNext(bot, message);
    await search(bot, message, message.user.prevSearchType, false);
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question