Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. async function updateWidget() {
  2.     var tops = []
  3.     for (i=1;i<200000;i++) {
  4.         if(acc.users[i]) {
  5.             if(acc.users[i].level < 4) {
  6.                 tops.push({id: i, idvk: acc.users[i].id});
  7.             }
  8.         }
  9.     }
  10.  
  11.     var script = {
  12.         title: `Топ лучших игроков! `,
  13.         more: `Обновился ${data()} в ${time()}`,
  14.         more_url: `vk.com/write-186743893`,
  15.         head: [
  16.  
  17.         {
  18.             text: 'Ник'
  19.         },
  20.  
  21.         {
  22.             text: 'Деньги',
  23.             align: 'right'
  24.         },
  25.  
  26.         {
  27.             text: 'Бицухи',
  28.             align: 'right'
  29.         },
  30.  
  31.         {
  32.             text: 'Привелегия',
  33.             align: 'right'
  34.         },
  35.         ],
  36.         body: []
  37.     }
  38.  
  39.     for (var g = 0; g < 10; g++) {
  40.         if (tops.length > g) {
  41.             var ups = g;
  42.             ups += 1;
  43.             if(g <= 8) ups = `${ups}`
  44.                 if(g == 9) ups = `10`
  45.                     script.body.push([
  46.  
  47.                     {
  48.                         icon_id: `id${tops[g].idvk}`,
  49.                         text: `${acc.users[tops[g].id].prefix}`,
  50.                         url: `vk.com/id${tops[g].idvk}`
  51.                     },
  52.  
  53.                     {
  54.                         text: `${spaces(acc.users[tops[g].id].balance)}$`
  55.                     },
  56.  
  57.                     {
  58.                         text: `${spaces(acc.users[tops[g].id].bomj.pvp)}`
  59.                     },
  60.  
  61.                     {
  62.                         text: `'${Args.uid}'   ${acc.users[tops[g].id].level.toString().replace(/0/gi, "🚬 Бомж").replace(/1/gi, "💰Богач").replace(/2/gi, "💸 Министр").replace(/3/gi, "🔮СНАК🔮").replace(/4/gi, "Администратор").replace(/5/gi, "Гл.Администратор").replace(/6/gi, "👑 CREATOR 👑")}`
  63.                     },
  64.                     ])
  65.             }
  66.         }
  67.         requests.post({url: 'https://api.vk.com/method/appWidgets.update', form:{
  68.             v: '5.95',
  69.             type: 'table',
  70.             code: `return ${JSON.stringify(script)};`,
  71.             access_token: `${config.wdt}`
  72.         }
  73.     },
  74.     function(err, resp, body) {
  75.         console.log(`${JSON.stringify(body)}`)
  76.     })
  77.     }
  78.     updateWidget()
  79.     setInterval(updateWidget, 30000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement