-
-
Notifications
You must be signed in to change notification settings - Fork 508
/
_antispam.js
31 lines (28 loc) · 903 Bytes
/
_antispam.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
25
26
27
28
29
30
31
let handler = m => m
handler.all = async function (m) {
this.spam = this.spam ? this.spam : {}
if (!(m.sender in this.spam)) {
let spaming = {
jid: await m.sender,
spam: 0,
lastspam: 0
}
this.spam[spaming.jid] = spaming
} else try {
this.spam[m.sender].spam += 1
if (new Date - this.spam[m.sender].lastspam > 4000) {
if (this.spam[m.sender].spam > 6) {
this.spam[m.sender].spam = 0
this.spam[m.sender].lastspam = new Date * 1
//global.DATABASE._data.users[m.sender].Banneduser = true
m.reply('*Jangan Spam!!*')
} else {
this.spam[m.sender].spam = 0
this.spam[m.sender].lastspam = new Date * 1
}
}
} catch (e) {
console.log(e)
}
}
module.exports = handler