diff --git a/plugins/info-bannedList.js b/plugins/info-bannedList.js index c488dc00e..470d85b6d 100644 --- a/plugins/info-bannedList.js +++ b/plugins/info-bannedList.js @@ -1,23 +1,42 @@ let handler = async (m, { conn, isOwner }) => { let chats = Object.entries(global.db.data.chats).filter(chat => chat[1].isBanned) let users = Object.entries(global.db.data.users).filter(user => user[1].banned) + + let _chatlist = chats.map(([jid], i) => { + let formattedJid = jid.endsWith('@s.whatsapp.net') + ? jid.split('@')[0] + : jid.endsWith('@g.us') + ? jid + : jid + + return `├ ${i + 1}. ${formattedJid}`.trim() + }) + + let _userlist = users.map(([jid], i) => { + let formattedJid = jid.endsWith('@s.whatsapp.net') + ? jid.split('@')[0] + : jid.endsWith('@g.us') + ? jid + : jid + + return `├ ${i + 1}. ${formattedJid}`.trim() + }) + let caption = ` ┌〔 Daftar Chat Terbanned 〕 -├ Total : ${chats.length} Chat${chats ? '\n' + chats.map(([jid], i) => ` -├ ${i + 1}. ${conn.getName(jid) == undefined ? 'Unknown' : conn.getName(jid)} -├ ${isOwner ? '@' + jid.split`@`[0] : jid} -`.trim()).join('\n') : ''} +├ Total : ${chats.length} Chat +${_chatlist.join('\n')} └──── ┌〔 Daftar Pengguna Terbanned 〕 -├ Total : ${users.length} Pengguna${users ? '\n' + users.map(([jid], i) => ` -├ ${i + 1}. ${conn.getName(jid) == undefined ? 'Unknown' : conn.getName(jid)} -├ ${isOwner ? '@' + jid.split`@`[0] : jid} -`.trim()).join('\n') : ''} +├ Total : ${users.length} Pengguna +${_userlist.join('\n')} └──── `.trim() + conn.reply(m.chat, caption, m, { contextInfo: { mentionedJid: conn.parseMention(caption) } }) } + handler.help = ['bannedlist'] handler.tags = ['info'] handler.command = /^listban(ned)?|ban(ned)?list|daftarban(ned)?$/i