function findNick(arr, nick) {
const res = arr.find(i => i.nick == nick);
if (res) return;
return arr;
}
console.log(findNick(users, 'хай'));
const { VK } = require('vk-io');
const users = require('./users.json');
const fs = require('fs');
const vk = new VK({
token: '...'
});
vk.updates.on('message', async (next, context) => {
let name = await vk.api.users.get({
user_ids: next.senderId
});
users.push({
id: next.senderId,
firstname: name[0].first_name,
lastname: name[0].last_name,
warns: 0,
role: 1,
flip: 0,
botmute: 0,
rank: "Участник",
ban: false,
isBanned: "Нет",
tempban: 0,
mute: 0,
mutesleft: 0,
violations: 0,
nick: "Не установлен"
})
fs.writeFileSync("./users.json", JSON.stringify(users, null, "\t"))
return context()
})
var modal = document.querySelector('#auth');
document.querySelector('.auth a').addEventListener('click', function(event) {
event.preventDefault();
modal.style.display = "block";
})
document.querySelector('.close').addEventListener('click', function(event) {
event.preventDefault();
modal.style.display = "none";
})
var modal = document.querySelector('#auth')
modal.addEventListener('click', function(event) {
event.preventDefault();
modal.style.display = "block";
})
document.querySelector('.close').addEventListener('click', function(event) {
event.preventDefault();
modal.style.display = "none";
})