descargas-gitclone.js 2.5 KB

12345678910111213141516171819202122232425
  1. import fetch from 'node-fetch'
  2. const regex = /(?:https|git)(?::\/\/|@)github\.com[\/:]([^\/:]+)\/(.+)/i
  3. let handler = async (m, { args, usedPrefix, command }) => {
  4. if (!args[0]) return conn.reply(m.chat, `โš ๏ธ*๐™„๐™ฃ๐™œ๐™ง๐™š๐™จ๐™š ๐™ช๐™ฃ ๐™š๐™ฃ๐™ก๐™–๐™˜๐™š ๐™™๐™š ๐™‚๐™ž๐™ฉ๐™๐™ช๐™—*\nโ€ข *๐™€๐™Ÿ :* ${usedPrefix + command} ${md}`, m, {contextInfo: {externalAdReply :{ mediaUrl: null, mediaType: 1, description: null, title: mg, body: ' ๐Ÿ’ซ ๐’๐ฎ๐ฉ๐ž๐ซ ๐๐จ๐ญ ๐ƒ๐ž ๐–๐ก๐š๐ญ๐ฌ๐š๐ฉ๐ฉ ๐Ÿฅณ ', previewType: 0, thumbnail: img.getRandom(), sourceUrl: redes.getRandom()}}})
  5. if (!regex.test(args[0])) return conn.reply(m.chat, `โš ๏ธ ๐™š๐™จ๐™ค ๐™ฃ๐™ค ๐™š๐™จ ๐™ช๐™ฃ ๐™š๐™ฃ๐™ก๐™–๐™˜๐™š ๐™™๐™š ๐™œ๐™ž๐™ฉ๐™๐™ช๐™— ๐™—๐™ค๐™ก๐™ช๐™™๐™ค ๐Ÿคก`, m, {contextInfo: {externalAdReply :{ mediaUrl: null, mediaType: 1, description: null, title: iig, body: ' ๐Ÿ’ซ ๐’๐ฎ๐ฉ๐ž๐ซ ๐๐จ๐ญ ๐ƒ๐ž ๐–๐ก๐š๐ญ๐ฌ๐š๐ฉ๐ฉ ๐Ÿฅณ ', previewType: 0, thumbnail: img.getRandom(), sourceUrl: redes.getRandom()}}})
  6. try {
  7. let [_, user, repo] = args[0].match(regex) || []
  8. repo = repo.replace(/.git$/, '')
  9. let url = `https://api.github.com/repos/${user}/${repo}/zipball`
  10. let filename = (await fetch(url, { method: 'HEAD' })).headers.get('content-disposition').match(/attachment; filename=(.*)/)[1]
  11. conn.reply(m.chat, `*โŒ› ๐‚๐š๐ฅ๐ฆ๐š โœ‹ ๐‚๐ฅ๐š๐œ๐ค, ๐˜๐š ๐ž๐ฌ๐ญ๐จ๐ฒ ๐„๐ง๐ฏ๐ข๐š๐๐จ ๐ž๐ฅ ๐š๐ซ๐œ๐ก๐ข๐ฏ๐จ ๐Ÿš€*\n*๐’๐ข ๐ง๐จ ๐ฅ๐ž ๐ฅ๐ฅ๐ž๐ ๐š ๐ž๐ฅ ๐š๐ซ๐œ๐ก๐ข๐ฏ๐จ ๐ž๐ฌ ๐๐ž๐›๐ข๐๐จ ๐š ๐ช๐ฎ๐ž ๐ž๐ฅ ๐‘๐ž๐ฉ๐จ๐ฌ๐ข๐ญ๐จ๐ซ๐ข๐จ ๐ž๐ฌ ๐ฆ๐ฎ๐ฒ ๐ฉ๐ž๐ฌ๐š๐๐จ*`, m, {contextInfo: {externalAdReply :{ mediaUrl: null, mediaType: 1, description: null, title: wm, body: ' ๐Ÿ’ซ ๐’๐ฎ๐ฉ๐ž๐ซ ๐๐จ๐ญ ๐ƒ๐ž ๐–๐ก๐š๐ญ๐ฌ๐š๐ฉ๐ฉ ๐Ÿฅณ ', previewType: 0, thumbnail: img.getRandom(), sourceUrl: redes.getRandom()}}})
  12. conn.sendFile(m.chat, url, filename, null, m, null, fake)
  13. handler.limit = 2
  14. } catch (e) {
  15. m.reply(`\`\`\`โš ๏ธ OCURRIO UN ERROR โš ๏ธ\`\`\`\n\n> *Reporta el siguiente error a mi creador con el comando:*#report\n\n>>> ${e} <<<< `)
  16. console.log(e)
  17. handler.limit = 0 //โŒNo gastada diamante si el comando falla
  18. }}
  19. handler.help = ['gitclone <url>']
  20. handler.tags = ['downloader']
  21. handler.command = /gitclone|clonarepo|clonarrepo|repoclonar/i
  22. handler.register = true
  23. //handler.limit = 2
  24. handler.level = 2
  25. export default handler