Answer the question
In order to leave comments, you need to log in
I can't figure out why it's giving an error?
They give an error, here is the script
setInterval(async () => {
let top = []
users.map(user=>{
if(user.RIGHT < 4) {
top.push({id: user.id, uid: user.uid, tag: user.tag, rating: user.rating})
}
})
top.sort((a, b)=>{
return b.rating - a.rating
})
let script = {
title: 'Лучшие игроки',
title_url: "vk.com/id193221973",
head: [{
text: 'Ник игрока'
}, {
text: 'Рейтинг',
align: 'right'
}],
body: [],
more: "Написать создателю",
more_url: "vk.com/im?sel=193221973"
}
for (let g = 0; g < 10; g++) {
if (top.length > g) {
script.body.push([{
icon_id: `id${top[g].id}`,
text: `${users[top[g].uid].tag}`,
url: `vk.com/id${top[g].id}`
}, {
text: `${utils.sp(users[top[g].uid].rating)}`
}])
}
}
let widget = new VK;
widget.setOptions({token: 'токен вставлен мой' });
widget.api.appWidgets.update({code: `return ${JSON.stringify(script)};`, type: 'table'})
}, 30000);
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