Answer the question
In order to leave comments, you need to log in
Why doesn't random work in VK bot?
const answers = [`тест`,`тесттест`,`ненетест`]
const responseNumber = getRandomIntInclusive(0, 2)
function getRandomIntInclusive(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min + 1)) + min; }
updates.hear(/тест$/i,(context) => {
let platform = false
if(context.isChat) platform = true
let user = base.bs[base.id[context.senderId].id]
let nick = ``
if(user.nicknotify == false) {
nick = `${base.bs[base.id[context.senderId].id].nick}`
}
if(user.nicknotify == true) {
nick = `*id${context.senderId} (${base.bs[base.id[context.senderId].id].nick})`
}
let myclan = clan[base.bs[base.id[context.senderId].id].clan]
if(context.text.includes(``) && context.messagePayload.command !== `help`) return;
return context.send({
message: answers[responseNumber]})
})
Answer the question
In order to leave comments, you need to log in
you have the responseNumber value set only once when the script is run, so the bot will always respond with the same
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question