-
Notifications
You must be signed in to change notification settings - Fork 9
/
jodoh.js
30 lines (25 loc) · 993 Bytes
/
jodoh.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
const fetch = require('node-fetch')
let handler = async (m, { conn, text, usedPrefix, command }) => {
if (!text) throw `contoh:\n${usedPrefix + command} ariffb|${conn.getName(m.sender)}`
let [nama1, nama2] = text.split(/[&|.]/i)
if (!nama1 || !nama2) throw `contoh:\n${usedPrefix + command} ariffb|${conn.getName(m.sender)}`
let res = await fetch(global.API('zeks', '/api/primbonjodoh', { nama1, nama2 }, 'apikey'))
if (!res.ok) throw eror
let json = await res.json()
if (!json.status) throw json
let { thumb, positif, negatif } = json.result
let caption = `
*Nama kamu:* ${json.result.nama1}
*Nama doi:* ${json.result.nama2}
*Positif:*
${positif}
*Negatif:*
${negatif}
`.trim()
conn.sendFile(m.chat, thumb, 'file.png', caption, m, 0, { thumbnail: await (await fetch(thumb)).buffer() })
}
handler.help = ['jodoh'].map(v => v + ' <nama>|<nama doi>')
handler.tags = ['fun']
handler.command = /^(jodoh)$/i
handler.limit = true
module.exports = handler