-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgroupInfo.js
82 lines (67 loc) · 2.23 KB
/
groupInfo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
let handler = async (m, { conn, participants, groupMetadata, text }) => {
const getGroupAdmins = (participants) => {
admins = []
for (let i of participants) {
i.isAdmin ? admins.push(i.jid) : ''
}
return admins
}
let pp = './src/avatar_contact.png'
try {
pp = await conn.getProfilePicture(m.chat)
} catch (e) {
} finally {
let { isBanned, welcome, detect, sWelcome, sBye, sPromote, sDemote, antiLink, expired, descUpdate, stiker } = global.db.data.chats[m.chat]
const groupAdmins = getGroupAdmins(participants)
let listAdmin = groupAdmins.map((v, i) => `${i + 1}. @${v.split`@`[0]}`).join('\n')
if (text) return m.reply(msToDate(expired - new Date() * 1))
let caption = `*Informasi Grup*\n
*ID:*
${groupMetadata.id}
*Nama:*
${groupMetadata.subject}
*Deskripsi:*
${groupMetadata.desc}
*Total Anggota:*
${participants.length} Anggota
*Pembuat Grup:*
@${m.chat.split`-`[0]}
*Admin Grup:*
${listAdmin}
*Pengaturan Bot:*
${antiLink ? '✅' : '❌'} Anti Link
${global.db.data.chats[m.chat].delete ? '❌' : '✅'} Anti Delete
${isBanned ? '✅' : '❌'} Banned
${descUpdate ? '✅' : '❌'} Deskprisi
${detect ? '✅' : '❌'} Detect
${stiker ? '✅' : '❌'} Stiker
${welcome ? '✅' : '❌'} Welcome
*Pengaturan Pesan Bot:*
Welcome: ${sWelcome}
Bye: ${sBye}
Promote: ${sPromote}
Demote: ${sDemote}
*Tersisa:*
${msToDate(expired - new Date() * 1)}
`.trim()
let mentionedJid = groupAdmins.concat([`${m.chat.split`-`[0]}@s.whatsapp.net`])
conn.sendFile(m.key.remoteJid, pp, 'pp.jpg', caption, m, 0, { contextInfo: { mentionedJid } })
}
}
handler.help = ['infogrup']
handler.tags = ['group']
handler.command = /^(gro?upinfo|info(gro?up|gc))$/i
handler.group = true
module.exports = handler
function msToDate(ms) {
temp = ms
days = Math.floor(ms / (24 * 60 * 60 * 1000));
daysms = ms % (24 * 60 * 60 * 1000);
hours = Math.floor((daysms) / (60 * 60 * 1000));
hoursms = ms % (60 * 60 * 1000);
minutes = Math.floor((hoursms) / (60 * 1000));
minutesms = ms % (60 * 1000);
sec = Math.floor((minutesms) / (1000));
return days + " hari " + hours + " jam " + minutes + " menit";
// +minutes+":"+sec;
}