Nurutomo / wabot-aq

WhatsApp Bot
GNU General Public License v3.0
709 stars 1.38k forks source link

Fix data Leaderboard #177

Closed ghost closed 3 years ago

ghost commented 3 years ago

Data peringkat leaderboard ga nambah gitu" aja? Gimana ya cara fixnya?

ariffb25 commented 3 years ago

maksud?

ghost commented 3 years ago

maksud?

IMG_20210331_105813

ghost commented 3 years ago

Noh gitu terus ga ada yg berubah, padahal level, limit, sama exp member udah lebih dan nambah terus tapi ga masuk ke leaderboard

ariffb25 commented 3 years ago

oalah w masih pake leaderboard yg versi lama wkwk

ariffb25 commented 3 years ago
let handler = async (m, { conn, args }) => {
  let sortedExp = Object.entries(global.DATABASE.data.users).sort((a, b) => b[1].exp - a[1].exp)
  let sortedLim = Object.entries(global.DATABASE.data.users).sort((a, b) => b[1].limit - a[1].limit)
  let sortedLev = Object.entries(global.DATABASE.data.users).sort((a, b) => b[1].level - a[1].level)
  let usersExp = sortedExp.map(v => v[0])
  let usersLim = sortedLim.map(v => v[0])
  let usersLev = sortedLev.map(v => v[0])
  let len = args[0] && args[0].length > 0 ? Math.min(1000, Math.max(parseInt(args[0]), 5)) : Math.min(3, sortedExp.length)
  let text = `
• *XP Leaderboard Top ${len}* •
Kamu: *${usersExp.indexOf(m.sender) + 1}* dari *${usersExp.length}*

${sortedExp.slice(0, len).map(([user, data], i) => (i + 1) + '. ' + conn.getName(user) + ': *' + data.exp + ' Exp*').join`\n`}

• *Apoin Leaderboard Top ${len}* •
Kamu: *${usersLim.indexOf(m.sender) + 1}* dari *${usersLim.length}*

${sortedLim.slice(0, len).map(([user, data], i) => (i + 1) + '. ' + conn.getName(user) + ': *' + data.limit + ' Apoin*').join`\n`}

• *Level Leaderboard Top ${len}* •
Kamu: *${usersLev.indexOf(m.sender) + 1}* dari *${usersLev.length}*

${sortedLev.slice(0, len).map(([user, data], i) => (i + 1) + '. ' + conn.getName(user) + ': *' + data.level + ' Level*').join`\n`}
`.trim()
  conn.reply(m.chat, text, m, {
    contextInfo: {
      mentionedJid: [...usersExp.slice(0, len), ...usersLim.slice(0, len), ...usersLev.slice(0, len)]
    }
  })
}
handler.help = ['leaderboard [jumlah user]', 'lb [jumlah user]']
handler.tags = ['xp']
handler.command = /^(leaderboard|lb)$/i
handler.owner = false
handler.mods = false
handler.premium = false
handler.group = false
handler.private = false

handler.admin = false
handler.botAdmin = false

handler.fail = null
handler.exp = 0

module.exports = handler
ghost commented 3 years ago

oalah w masih pake leaderboard yg versi lama wkwk

Iya gua juga sih, pake yg lama soalnya yg baru eror. Makanya gua nanya

RC047 commented 3 years ago

maksud?

IMG_20210331_105813

Coba pake bot baru sama yg baru,, jangan digabungin yg lama sama yg baru,, jdinya gtu

ghost commented 3 years ago

Aing pake yg baru loh gan, sampe hapus data termux terus install bot baru dengan script yg baru ..pas coba ga bisa tetep aja ga masuk ke leaderboard. Yaudah gua ganti ke script leaderboard yg lama eh bisa kedetect semua.

RC047 commented 3 years ago

Aing pake yg baru loh gan, sampe hapus data termux terus install bot baru dengan script yg baru ..pas coba ga bisa tetep aja ga masuk ke leaderboard. Yaudah gua ganti ke script leaderboard yg lama eh bisa kedetect semua.

Brarti bug eta mah :v

github-actions[bot] commented 3 years ago

stale issue