const vk = new VK({
^
SyntaxError: Identifier 'vk' has already been declared
at Object.compileFunction (node:vm:355:18)
at wrapSafe (node:internal/modules/cjs/loader:1038:15)
at Module._compile (node:internal/modules/cjs/loader:1072:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47
const { VK } = require('vk-io');
const vk = new VK();
const users = require('/users.json')
const fs = require('fs');
const vk = new VK({
token: ''"
});
function timeLeft(stamp) {
}
setInterval(async () => {
fs.writeFileSync("./users.json", JSON.stringify(users, null, "\t"))
}, 500);
vk.updates.on(['new_message'], (next, context) => {
if(users.filter(x => x.id === msg.sendorID)[0]) return context();
users.push({
id: next.sendorID,
balance: 5000,
work: {
timer: 0,
name: 'Нет',
id: 0
},
nick: 'Игрок'
})
return context()
})
vk.updates.hear(/^проф/i, msg => {
user = users.filter(x => x.id === msg.senderId)[0]
msg.send(`${user.nick}, вот твой профиль:\n Баланс: ${user.balance}\n Работа: ${user.work.name}`)
})
console.log("ok");
vk.updates.start().catch(console.error);