-
Notifications
You must be signed in to change notification settings - Fork 66
/
absen-absen.js
34 lines (31 loc) · 1003 Bytes
/
absen-absen.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
let handler = async (m, { conn }) => {
let id = m.chat
conn.absen = conn.absen ? conn.absen : {}
if (!(id in conn.absen)) {
await conn.sendButton(m.chat, `tidak ada absen berlangsung!`, wm, 'mulai absen', `.mulaiabsen`, m)
throw 0
}
let absen = conn.absen[id][1]
const wasVote = absen.includes(m.sender)
if (wasVote) throw 'udah absen!'
absen.push(m.sender)
let d = new Date
let date = d.toLocaleDateString('id', {
day: 'numeric',
month: 'long',
year: 'numeric'
})
let list = absen.map((v, i) => `├ ${i + 1}. ${db.data.users[v].name}`).join('\n')
let caption = `
${date}
${conn.absen[id][2]}
┌「 absen 」
├ total: ${absen.length}
${list}
└────`.trim()
await conn.send2Button(m.chat, caption, wm, 'hadir', `.absen`, 'cek', `.cekabsen`, m, { mentions: [m.sender] })
}
handler.help = ['absen']
handler.tags = ['absen']
handler.command = /^(absen|hadir|presence)$/i
module.exports = handler