fun-suitpvp.js 6.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. let handler = m => m
  2. handler.before = async function (m) {
  3. let pp = 'https://telegra.ph/file/c7924bf0e0d839290cc51.jpg'
  4. 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]" }
  5. this.suit = this.suit ? this.suit : {}
  6. if (db.data.users[m.sender].suit < 0) db.data.users[m.sender].suit = 0
  7. let room = Object.values(this.suit).find(room => room.id && room.status && [room.p, room.p2].includes(m.sender))
  8. if (room) {
  9. let win = ''
  10. let tie = false
  11. if (m.sender == room.p2 && /^(acc(ept)?|Aceptar|acerta|aceptar|gas|aceptare?|nao|Rechazar|rechazar|ga(k.)?bisa)/i.test(m.text) && m.isGroup && room.status == 'wait') {
  12. if (/^(tolak|gamau|rechazar|ga(k.)?bisa)/i.test(m.text)) {
  13. let textno = `โš ๏ธ@${room.p2.split`@`[0]} ๐™๐™€๐˜พ๐™ƒ๐˜ผ๐™•๐™Š ๐™€๐™‡ ๐™‹๐™‘๐™‹, ๐™€๐™‡ ๐™…๐™๐™€๐™‚๐™Š ๐™Ž๐™€ ๐˜พ๐˜ผ๐™‰๐˜พ๐™€๐™‡๐˜ผ`
  14. m.reply(textno, null, {mentions: this.parseMention(textno)})
  15. delete this.suit[room.id]
  16. return !0 }
  17. room.status = 'play'
  18. room.asal = m.chat
  19. clearTimeout(room.waktu)
  20. let textplay = `๐ŸŽฎ ๐™€๐™‡ ๐™…๐™๐™€๐™‚๐™Š๐™Ž ๐˜พ๐™Š๐™ˆ๐™„๐™€๐™‰๐™•๐˜ผ, ๐™‡๐˜ผ๐™Ž ๐™Š๐™‹๐˜พ๐™„๐™Š๐™‰๐™€๐™Ž ๐™ƒ๐˜ผ๐™‰ ๐™Ž๐™„๐˜ฟ๐™Š ๐™€๐™‰๐™‘๐™„๐˜ผ๐˜ฟ๐™Š๐™Ž ๐˜ผ ๐™‡๐™Š๐™Ž ๐˜พ๐™ƒ๐˜ผ๐™ ๐™‹๐™๐™„๐™‘๐˜ผ๐˜ฟ๐™Š ๐˜ฟ๐™€ @${room.p.split`@`[0]} ๐™” @${room.p2.split`@`[0]}\n\n๐™Ž๐™€๐™‡๐™€๐˜พ๐˜พ๐™„๐™Š๐™‰๐™€๐™‰ ๐™๐™‰๐˜ผ ๐™Š๐™‹๐˜พ๐™„๐™Š๐™‰ ๐™€๐™‰ ๐™Ž๐™๐™Ž ๐˜พ๐™ƒ๐˜ผ๐™๐™Ž ๐™‹๐™๐™„๐™‘๐˜ผ๐˜ฟ๐™Š ๐™๐™€๐™Ž๐™‹๐™€๐˜พ๐™๐™„๐™‘๐˜ผ๐™ˆ๐™€๐™‰๐™๐™€\n\n> *Elegir opciรณn en wa.me/${conn.user.jid.split`@`[0]}*`
  21. m.reply(textplay, m.chat, {mentions: this.parseMention(textplay)})
  22. let comienzop = `โš ๏ธ ๐™‹๐™Š๐™ ๐™๐˜ผ๐™‘๐™Š๐™ ๐™Ž๐™€๐™‡๐™€๐˜พ๐˜พ๐™„๐™Š๐™‰๐™€ ๐™๐™‰๐˜ผ ๐˜ฟ๐™€ ๐™‡๐˜ผ๐™Ž ๐™Ž๐™„๐™‚๐™๐™„๐™€๐™‰๐™๐™€๐™Ž ๐™Š๐™‹๐˜พ๐™„๐™Š๐™‰๐™€๐™Ž\n\n> แƒฆ Piedra\n> แƒ“ Papel\n> แƒฆ Tijera\n\n> *Responda al mensaje con la opciรณn*`
  23. let comienzop2 = `โš ๏ธ ๐™‹๐™Š๐™ ๐™๐˜ผ๐™‘๐™Š๐™ ๐™Ž๐™€๐™‡๐™€๐˜พ๐˜พ๐™„๐™Š๐™‰๐™€ ๐™๐™‰๐˜ผ ๐˜ฟ๐™€ ๐™‡๐˜ผ๐™Ž ๐™Ž๐™„๐™‚๐™๐™„๐™€๐™‰๐™๐™€๐™Ž ๐™Š๐™‹๐˜พ๐™„๐™Š๐™‰๐™€๐™Ž\n\n> แƒฆ Piedra\n> แƒฆ Papel\n> แƒฆ Tijera\n\n> *Responda al mensaje con la opciรณn*`
  24. if (!room.pilih) this.sendMessage(room.p, { text: comienzop }, { quoted: fkontak })
  25. if (!room.pilih2) this.sendMessage(room.p2, { text: comienzop2 }, { quoted: fkontak })
  26. room.waktu_milih = setTimeout(() => {
  27. let iniciativa = `โš ๏ธ ๐™‰๐™„๐™‰๐™‚๐™๐™‰ ๐™…๐™๐™‚๐˜ผ๐˜ฟ๐™Š๐™ ๐™๐™Š๐™ˆ๐™Š ๐™‡๐˜ผ ๐™„๐™‰๐™„๐˜พ๐™„๐˜ผ๐™๐™„๐™‘๐˜ผ ๐˜ฟ๐™€ ๐™€๐™ˆ๐™‹๐™€๐™•๐˜ผ๐™ ๐™€๐™‡ ๐™…๐™๐™€๐™‚๐™Š๐™Ž, ๐™€๐™‡ ๐™‹๐™‘๐™‹ ๐™Ž๐™€ ๐˜ผ๐™ƒ ๐˜พ๐˜ผ๐™‰๐˜พ๐™€๐™‡๐˜ผ๐˜ฟ๐™Š`
  28. if (!room.pilih && !room.pilih2) this.sendMessage(m.chat, { text: iniciativa }, { quoted: fkontak })
  29. else if (!room.pilih || !room.pilih2) {
  30. win = !room.pilih ? room.p2 : room.p
  31. let textnull = `โš ๏ธ @${(room.pilih ? room.p2 : room.p).split`@`[0]} ๐™‰๐™Š ๐™€๐™‡๐™€๐™‚๐™„๐™Ž๐™๐™€ ๐™‰๐™„๐™‰๐™‚๐™๐™‰๐˜ผ ๐™Š๐™‹๐˜พ๐™„๐™Š๐™‰, ๐™๐™„๐™‰ ๐˜ฟ๐™€๐™‡ ๐™‹๐™‘๐™‹`
  32. this.sendMessage(m.chat, { text: textnull }, { quoted: fkontak }, { mentions: this.parseMention(textnull) })
  33. db.data.users[win == room.p ? room.p : room.p2].exp += room.poin
  34. db.data.users[win == room.p ? room.p : room.p2].exp += room.poin_bot
  35. db.data.users[win == room.p ? room.p2 : room.p].exp -= room.poin_lose
  36. }
  37. delete this.suit[room.id]
  38. return !0
  39. }, room.timeout)}
  40. let jwb = m.sender == room.p
  41. let jwb2 = m.sender == room.p2
  42. let g = /tijera/i
  43. let b = /piedra/i
  44. let k = /papel/i
  45. let reg = /^(tijera|piedra|papel)/i
  46. if (jwb && reg.test(m.text) && !room.pilih && !m.isGroup) {
  47. room.pilih = reg.exec(m.text.toLowerCase())[0]
  48. room.text = m.text
  49. m.reply(`โœ… ๐™ƒ๐˜ผ๐™Ž ๐™€๐™‡๐™€๐™‚๐™„๐˜ฟ๐™Š ${m.text}, ๐™๐™€๐™‚๐™๐™€๐™Ž๐˜ผ ๐˜ผ๐™‡ ๐™‚๐™๐™๐™‹๐™Š ๐™” ${room.pilih2 ? `*๐™๐™€๐™‘๐™„๐™Ž๐˜ผ ๐™‡๐™Š๐™Ž ๐™๐™€๐™Ž๐™๐™‡๐™๐˜ผ๐˜ฟ๐™Š๐™Ž*` : '*๐™€๐™Ž๐™‹๐™€๐™๐˜ผ ๐™‡๐™Š๐™Ž ๐™๐™€๐™Ž๐™๐™‡๐™๐˜ผ๐˜ฟ๐™Š๐™Ž*'}`)
  50. if (!room.pilih2) this.reply(room.p2, `${lenguajeGB['smsAvisoIIG']()}๐™€๐™‡ ๐™Š๐™‹๐™Š๐™‰๐™€๐™‰๐™๐™€ ๐˜ผ๐™ƒ ๐™€๐™‡๐™€๐™‚๐™„๐˜ฟ๐™Š, ๐™€๐™Ž ๐™๐™ ๐™๐™๐™๐™‰๐™Š ๐˜ฟ๐™€ ๐™€๐™‡๐™€๐™‚๐™„๐™`, fkontak, 0)}
  51. if (jwb2 && reg.test(m.text) && !room.pilih2 && !m.isGroup) {
  52. room.pilih2 = reg.exec(m.text.toLowerCase())[0]
  53. room.text2 = m.text
  54. m.reply(`โœ… ๐™ƒ๐˜ผ๐™Ž ๐™€๐™‡๐™€๐™‚๐™„๐˜ฟ๐™Š ${m.text}, ๐™๐™€๐™‚๐™๐™€๐™Ž๐˜ผ ๐˜ผ๐™‡ ๐™‚๐™๐™๐™‹๐™Š ๐™” ${room.pilih ? `*๐™๐™€๐™‘๐™„๐™Ž๐˜ผ ๐™‡๐™Š๐™Ž ๐™๐™€๐™Ž๐™๐™‡๐™๐˜ผ๐˜ฟ๐™Š๐™Ž*` : '*๐™€๐™Ž๐™‹๐™€๐™๐˜ผ ๐™‡๐™Š๐™Ž ๐™๐™€๐™Ž๐™๐™‡๐™๐˜ผ๐˜ฟ๐™Š๐™Ž*'}`)
  55. if (!room.pilih) this.reply(room.p, `${lenguajeGB['smsAvisoIIG']()}๐™€๐™‡ ๐™Š๐™‹๐™Š๐™‰๐™€๐™‰๐™๐™€ ๐˜ผ๐™ƒ ๐™€๐™‡๐™€๐™‚๐™„๐˜ฟ๐™Š, ๐™€๐™Ž ๐™๐™ ๐™๐™๐™๐™‰๐™Š ๐˜ฟ๐™€ ๐™€๐™‡๐™€๐™‚๐™„๐™`, fkontak, 0)}
  56. let stage = room.pilih
  57. let stage2 = room.pilih2
  58. if (room.pilih && room.pilih2) {
  59. clearTimeout(room.waktu_milih)
  60. if (b.test(stage) && g.test(stage2)) win = room.p
  61. else if (b.test(stage) && k.test(stage2)) win = room.p2
  62. else if (g.test(stage) && k.test(stage2)) win = room.p
  63. else if (g.test(stage) && b.test(stage2)) win = room.p2
  64. else if (k.test(stage) && b.test(stage2)) win = room.p
  65. else if (k.test(stage) && g.test(stage2)) win = room.p2
  66. else if (stage == stage2) tie = true
  67. this.reply(room.asal, `๐Ÿฅณ ๐™๐™€๐™Ž๐™๐™‡๐™๐˜ผ๐˜ฟ๐™Š๐™Ž ๐˜ฟ๐™€๐™‡ ๐™‹๐™‘๐™‹\n\n${tie ? '๐Ÿฅด ๐™€๐™ˆ๐™‹๐˜ผ๐™๐™€!!' : ''} *@${room.p.split`@`[0]} (${room.text})* ${tie ? '' : room.p == win ? ` *๐™‚๐˜ผ๐™‰๐˜ผ๐™๐™๐™€ ๐Ÿฅณ ${room.poin} XP*` : ` *๐™‹๐™€๐™๐˜ฟ๐™„๐™Šฬ ๐Ÿคก ${room.poin_lose} XP*`}
  68. *@${room.p2.split`@`[0]} (${room.text2})* ${tie ? '' : room.p2 == win ? `*๐™‚๐˜ผ๐™‰๐˜ผ๐™๐™๐™€ ๐Ÿฅณ ${room.poin} XP*` : ` *๐™‹๐™€๐™๐˜ฟ๐™„๐™Šฬ ๐Ÿคก ${room.poin_lose} XP*`}
  69. `.trim(), m, { mentions: [room.p, room.p2] } )
  70. if (!tie) {
  71. db.data.users[win == room.p ? room.p : room.p2].exp += room.poin
  72. db.data.users[win == room.p ? room.p : room.p2].exp += room.poin_bot
  73. db.data.users[win == room.p ? room.p2 : room.p].exp += room.poin_lose
  74. }
  75. delete this.suit[room.id]}}
  76. return !0
  77. }
  78. handler.exp = 0
  79. export default handler
  80. function random(arr) {
  81. return arr[Math.floor(Math.random() * arr.length)]}