forked from botsito2/pruebabot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfun-anonymous.js
24 lines (22 loc) · 895 Bytes
/
fun-anonymous.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
let handler = m => m
handler.before = async function (m, { match }) {
// if (match) return !1
if (!m.chat.endsWith('@s.whatsapp.net')) return !0
this.anonymous = this.anonymous ? this.anonymous : {}
let room = Object.values(this.anonymous).find(room => [room.a, room.b].includes(m.sender) && room.state === 'CHATTING')
if (room) {
if (/^.*(next|leave|start)/.test(m.text)) return
if (['.next', '.leave', '.start', 'Cari Partner', 'Keluar', 'Next'].includes(m.text)) return
let other = [room.a, room.b].find(user => user !== m.sender)
m.copyNForward(other, true, m.quoted && m.quoted.fromMe ? {
contextInfo: {
...m.msg.contextInfo,
forwardingScore: 1,
isForwarded: true,
participant: other
}
} : {})
}
return !0
}
module.exports = handler