Answer the question
In order to leave comments, you need to log in
The bot does not see the 2nd argument?
JS:
cmd.hear(/^(?:создать ставку)\s([^]+)$/i, async (msg, bot) => {
const user = await getUserData(msg.senderId)
let args1 = msg.$match[1]
let args2 = msg.$match[2]
if (args1 && args2 <= 0) return msg.send(`Введено некорректное значение!`)
if (args2 > user.money) return msg.send(`На балнасе недостаточно средств!`)
if (rooms.rooms[args1].igra === true) return msg.send(`В данный момент стол занят!`)
// if (rooms.rooms[i] > 10) return msg.send(`Такого стола нет!`)
// if (rooms.rooms[i] < 1) return msg.send(`Такого стола нет!`)
// if (rooms.rooms[i].play == true) return msg.send(`Стол занят!`)
rooms.rooms[args1].stavka += args2
rooms.rooms[args1].user1 += msg.senderId
return msg.send(`Вы созадли стол ${args1} со ставкой ${args2}`)
});
{
"rooms": {
"1": {
"stavka": null,
"user1": 620893364,
"user2": 0,
"igra": false
}
}
}
Answer the question
In order to leave comments, you need to log in
cmd.hear(/^(?:создать ставку)\s([0-9]+)\s([0-9]+)$/i, async (msg, bot) => {
const user = await getUserData(msg.senderId)
let args1 = msg.$match[1]
let args2 = msg.$match[2]
if (args1 && args2 <= 0) return msg.send(`Введено некорректное значение!`)
if (args2 > user.money) return msg.send(`На балансе недостаточно средств!`)
if (rooms.rooms[args1].igra === true) return msg.send(`В данный момент стол занят!`)
// if (rooms.rooms[i] > 10) return msg.send(`Такого стола нет!`)
// if (rooms.rooms[i] < 1) return msg.send(`Такого стола нет!`)
// if (rooms.rooms[i].play == true) return msg.send(`Стол занят!`)
rooms.rooms[args1].stavka += args2
rooms.rooms[args1].user1 += msg.senderId
return msg.send(`Вы создали стол ${args1} со ставкой ${args2}`)
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question