owner-addprem.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. let handler = async (m, { conn, text, usedPrefix, command }) => {
  2. let fkontak = { "key": { "participants":"[email protected]", "remoteJid": "status@broadcast", "fromMe": false, "id": "Halo" }, "message": { "contactMessage": { "vcard": `BEGIN:VCARD\nVERSION:3.0\nN:Sy;Bot;;;\nFN:y\nitem1.TEL;waid=${m.sender.split('@')[0]}:${m.sender.split('@')[0]}\nitem1.X-ABLabel:Ponsel\nEND:VCARD` }}, "participant": "[email protected]" }
  3. let who
  4. if (m.isGroup) who = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : false
  5. else who = m.chat
  6. let user = global.db.data.users[who]
  7. if (!who) throw `*โš ๏ธ ๐Œ๐„๐๐‚๐ˆ๐Ž๐๐€/๐‘๐„๐๐Ž๐๐ƒ๐€ ๐€๐‹ ๐Œ๐„๐๐’๐€๐‰๐„ ๐ƒ๐„ ๐‹๐€ ๐๐„๐‘๐’๐Ž๐๐€ ๐๐”๐„ ๐’๐„๐‘๐€ฬ ๐๐‘๐„๐Œ๐ˆ๐”๐Œ*\n\n*${usedPrefix + command} @${m.sender.split`@`[0]} 1*\n*${usedPrefix + command} 1*`
  8. let txt = text.replace('@' + who.split`@`[0], '').trim()
  9. let name = await '@' + who.split`@`[0]
  10. var hora1 = 3600000 * txt //1h
  11. var dia1 = 86400000 * txt //1d
  12. var semana1 = 604800000 * txt //1s
  13. var mes1 = 2629800000 * txt //1m
  14. var now = new Date() * 1
  15. if (!txt && !m.quoted) throw `*FALTA EL TIEMPO PREMIUM*`
  16. if (txt == 0 || txt == null) throw `*DEBE INGRESAR EL TIEMPO PREMIUM*\n\n*${usedPrefix + command} @${m.sender.split`@`[0]} 1*\n*${usedPrefix + command} 1*`
  17. if (isNaN(txt)) return m.reply(`*SOLO NรšMERO*\n\n*${usedPrefix + command} @${m.sender.split`@`[0]} 1*`)
  18. /*let titulo = [ 'PREMIUM 1', 'PREMIUM 2', 'PREMIUM 3', 'PREMIUM 4', 'PREMIUM 5', 'PREMIUM 6']
  19. let nombre = [ 'PREMIUM BรSICO', 'PREMIUM NORMAL', 'PREMIUM ESPECIAL', 'PREMIUM PRO', 'PREMIUM PLUS', 'PREMIUM MAGISTRAL']
  20. let descripciรณn = [ 'Premium durante 1 Hora', 'Premium durante 3 Horas', 'Premium durante 5 Horas', 'Premium durante 1 Dรญa', 'Premium durante 1 Semana', 'Premium durante 1 Mes']
  21. let tiempo = [ hora1, hora3, hora5, dia1, semana1, mes1]
  22. let comando = [ 'premium1', `${command[2]}`, `${command[3]}`, `${command[4]}`, `${command[5]}`, `${command[6]}`]
  23. let sections = Object.keys(titulo, nombre, descripciรณn, tiempo, comando).map((v, index) => ({ title: `${titulo[v]}`,
  24. rows: [{ title: `${nombre[v]}`, description: `${1 + index}. ${descripciรณn[v]}`, rowId: usedPrefix + comando[v] + ' ' + `${res ? `${res.map(v => '@' + v.split("@")[0])}` : ''}` + txt, }], }))
  25. const listMessage = {
  26. text: `*ELIJA EL TIEMPO PREMIUM*
  27. *${name}*
  28. ${wm}`,
  29. title: null,
  30. buttonText: `TIEMPO AQUร `,
  31. sections }
  32. if (command == 'addprem') {
  33. //if (!txt || !text) return
  34. await conn.sendMessage(m.chat, listMessage, {quoted: fkontak})}*/
  35. if (command == 'addprem' || command == 'userpremium') {
  36. if (now < user.premiumTime) user.premiumTime += hora1
  37. else user.premiumTime = now + hora1
  38. user.premium = true
  39. conn.reply(m.chat, `*๐ŸŽŸ๏ธ ๐™๐™Ž๐™๐™€๐˜ฟ ๐˜ผ๐™ƒ๐™Š๐™๐˜ผ ๐™€๐™Ž ๐™‹๐™๐™€๐™ˆ๐™„๐™๐™ˆ!!!*
  40. *โœจ ๐™‰๐™Š๐™ˆ๐˜ฝ๐™๐™€ ยป ${name}*
  41. *๐Ÿ• ๐™๐™„๐™€๐™ˆ๐™‹๐™Š : ๐™๐™„๐™ˆ๐™€ ยป* ${msToTime(hora1 - new Date())}
  42. *๐Ÿ“‰ ๐™๐™„๐™ˆ๐™€๐™ ยป ${user.premiumTime - now} seg*`, m, {contextInfo: {mentionedJid: conn.parseMention(name)}})}
  43. if (command == 'addprem2' || command == 'userpremium2') {
  44. if (now < user.premiumTime) user.premiumTime += dia1
  45. else user.premiumTime = now + dia1
  46. user.premium = true
  47. conn.reply(m.chat, `*๐ŸŽŸ๏ธ ๐™๐™Ž๐™๐™€๐˜ฟ ๐˜ผ๐™ƒ๐™Š๐™๐˜ผ ๐™€๐™Ž ๐™‹๐™๐™€๐™ˆ๐™„๐™๐™ˆ!!!*
  48. *โœจ ๐™‰๐™Š๐™ˆ๐˜ฝ๐™๐™€ ยป ${name}*
  49. *๐Ÿ• ๐™๐™„๐™€๐™ˆ๐™‹๐™Š : ๐™๐™„๐™ˆ๐™€ ยป ${msToTime(dias1 - new Date())}*
  50. *๐Ÿ“‰ ๐™๐™„๐™ˆ๐™€๐™ ยป ${user.premiumTime - now} seg*`, m, {contextInfo: {mentionedJid: conn.parseMention(name)}})}
  51. if (command == 'addprem3' || command == 'userpremium3') {
  52. if (now < user.premiumTime) user.premiumTime += semana1
  53. else user.premiumTime = now + semana1
  54. user.premium = true
  55. conn.reply(m.chat, `*๐ŸŽŸ๏ธ ๐™๐™Ž๐™๐™€๐˜ฟ ๐˜ผ๐™ƒ๐™Š๐™๐˜ผ ๐™€๐™Ž ๐™‹๐™๐™€๐™ˆ๐™„๐™๐™ˆ!!!*
  56. *โœจ ๐™‰๐™Š๐™ˆ๐˜ฝ๐™๐™€ ยป ${name}*
  57. *๐Ÿ• ๐™๐™„๐™€๐™ˆ๐™‹๐™Š : ๐™๐™„๐™ˆ๐™€ ยป ${msToTime(semana1 - new Date())}*
  58. *๐Ÿ“‰ ๐™๐™„๐™ˆ๐™€๐™ ยป ${user.premiumTime - now} seg*`, m, {contextInfo: {mentionedJid: conn.parseMention(name)}})}
  59. if (command == 'addprem4' || command == 'userpremium4') {
  60. if (now < user.premiumTime) user.premiumTime += mes1
  61. else user.premiumTime = now + mes1
  62. user.premium = true
  63. conn.reply(m.chat, `*๐ŸŽŸ๏ธ ๐™๐™Ž๐™๐™€๐˜ฟ ๐˜ผ๐™ƒ๐™Š๐™๐˜ผ ๐™€๐™Ž ๐™‹๐™๐™€๐™ˆ๐™„๐™๐™ˆ!!!*
  64. *โœจ ๐™‰๐™Š๐™ˆ๐˜ฝ๐™๐™€ ยป ${name}*
  65. *๐Ÿ• ๐™๐™„๐™€๐™ˆ๐™‹๐™Š : ๐™๐™„๐™ˆ๐™€ ยป ${msToTime(mes1 - new Date())}*
  66. *๐Ÿ“‰ ๐™๐™„๐™ˆ๐™€๐™ ยป ${user.premiumTime - now} seg*`, m, {contextInfo: {mentionedJid: conn.parseMention(name)}})}
  67. }
  68. handler.help = ['addprem [@user] <days>']
  69. handler.tags = ['owner']
  70. handler.command = ['addprem', 'userpremium', 'addprem2', 'userpremium2', 'addprem3', 'userpremium3', 'addprem4', 'userpremium4']
  71. handler.group = true
  72. handler.owner = true
  73. //handler.botAdmin = true
  74. export default handler
  75. function msToTime(duration) {
  76. var milliseconds = parseInt((duration % 1000) / 100),
  77. seconds = Math.floor((duration / 1000) % 60),
  78. minutes = Math.floor((duration / (1000 * 60)) % 60),
  79. hours = Math.floor((duration / (1000 * 60 * 60)) % 24)
  80. hours = (hours < 10) ? "0" + hours : hours
  81. minutes = (minutes < 10) ? "0" + minutes : minutes
  82. seconds = (seconds < 10) ? "0" + seconds : seconds
  83. return hours + " Horas " + minutes + " Minutos " + seconds + " Segundos "
  84. }