| 8 | description: 'Get information about the MEGA-MD GitHub repository', |
| 9 | usage: '.script', |
| 10 | async handler(sock, message, args, context) { |
| 11 | const chatId = context.chatId || message.key.remoteJid; |
| 12 | try { |
| 13 | const res = await fetch('https://api.github.com/repos/GlobalTechInfo/MEGA-MD'); |
| 14 | if (!res.ok) |
| 15 | throw new Error('Error fetching repository data'); |
| 16 | const json = await res.json(); |
| 17 | let txt = `*乂 MEGA MDX 乂*\n\n`; |
| 18 | txt += `✩ *Name* : ${json.name}\n`; |
| 19 | txt += `✩ *Watchers* : ${json.watchers_count}\n`; |
| 20 | txt += `✩ *Size* : ${(json.size / 1024).toFixed(2)} MB\n`; |
| 21 | txt += `✩ *Last Updated* : ${moment(json.updated_at).format('DD/MM/YY - HH:mm:ss')}\n`; |
| 22 | txt += `✩ *URL* : ${json.html_url}\n`; |
| 23 | txt += `✩ *Forks* : ${json.forks_count}\n`; |
| 24 | txt += `✩ *Stars* : ${json.stargazers_count}\n\n`; |
| 25 | txt += `💥 *MEGA MD*`; |
| 26 | const imgPath = path.join(process.cwd(), 'assets/thumb.png'); |
| 27 | const imgBuffer = fs.readFileSync(imgPath); |
| 28 | await sock.sendMessage(chatId, { image: imgBuffer, caption: txt }, { quoted: message }); |
| 29 | } |
| 30 | catch (error) { |
| 31 | console.error('Error in github command:', error); |
| 32 | await sock.sendMessage(chatId, { text: '❌ Error fetching repository information.' }, { quoted: message }); |
| 33 | } |
| 34 | } |
| 35 | }; |