N
N
NoDeJs2292020-06-04 16:47:16
In contact with
NoDeJs229, 2020-06-04 16:47:16

Why is the code not working correctly?

Here is the code

cmd.hear(/^(?: Нанять рабочего|нанять|нанять рабочего)\s([0-9]+)$/i, async (message, bot) => {
    let dodik = message.args[1]
    const biz = businesses.find(x => x.id === message.user.business);
    if (message.user.rab < message.args[1])
        return bot (`Слишком много рабочих.Для вашего бизнеса`)
    await bot (`Вы наняли ${message.args[1]} человек себе на работу `)
    message.user.kolrab55151 += dodik;
});

Why when I hire workers.
Then the variable becomes not "kolrab55151":1, but "kolrab55151":"1",

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2020-06-04
@Aetae

Well, because the result of string parsing is a string. Lead to the number explicitly.
And yes, fuck it. Respect your code, dude, even if you write deliberate shit.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question