Answer the question
In order to leave comments, you need to log in
The problem is in the clock in the VK game bot, what should I do?
The problem is in the clock in the VK game bot, everything was fine and bam all kapets
This is an error
358 lines
this.users.forEach((user) => {
358> message += `${user.color === multiply ? '' : ''} [id${user.user.id}|${user.user.firstName}] - ${utils.split(user.bet)} VKC на ${getColor(user.color)} цвет - ${user.color === multiply ? `победа (+${utils.split(user.bet * mapMultiply(multiply))} VKC)` : 'поражение'}\n`
})
await vk.api.messages.send({
peer_id: this.chatId,
message: stripIndents`
Выигрышным номером был ${this.wonNumber} (${getColor(multiply)} цвет).
Хеш игры: [${this.hash}]
Зашифрованный текст: [${this.wonNumber}|${this.salt}]
Итоги игры:
${message || 'Победителей нет'}
`,
attachment: images[this.wonNumber],
disable_mentions: true,
dont_parse_links: 1,
})
tick () {
if (!this.isStarted) return
if (this.time > 0) {
this.time--
} else {
392> this.getWinner()
}
return true
}
const sessionManager = new SessionManager()
const sceneManager = new SceneManager()
class Game {
constructor (chatId) {
this.chatId = chatId
this.wonNumber = 0
this.salt = 0
this.hash = 0
this.time = 0
this.users = []
this.isStarted = false
this.newGame()
313> setInterval(() => { this.tick() }, 1000)
}
newGame () {
this.wonNumber = random.integer(0, 53)
this.salt = random.string(random.integer(6, 14))
this.hash = crypto.createHash('sha256').update(`${this.wonNumber}|${this.salt}`).digest('hex')
this.time = 40
this.users = []
this.isStarted = false
console.log(this)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question