File size: 934 Bytes
d8a4b7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
let fetch = require('node-fetch');

let handler = async (m, { text, usedPrefix, command }) => {
    if (!text) throw `Gunakan contoh: ${usedPrefix}${command} semarang`;
    
    try {
        const res = await (await fetch(`https://api.botcahx.eu.org/api/tools/jadwalshalat?kota=${text}&apikey=${btc}`)).json();
        
        if (!res.status || res.result.code !== 200) {
            throw eror
        }
        
        let timings = res.result.data[0].timings;
        let jadwalSholat = Object.entries(timings)
            .map(([name, time]) => `*${name}:* ${time}`)
            .join('\n');
        
        let message = `
Jadwal Sholat untuk *${text}*
${jadwalSholat}
`.trim();
        
        m.reply(message);
    } catch (error) {
        throw eror
    }
};

handler.help = ['salat <daerah>'];
handler.tags = ['islam'];
handler.command = /^(jadwal)?s(a|o|ha|ho)lat$/i;
handler.limit = true;

module.exports = handler;