| export async function all(m) { | |
| if (!m.message) | |
| return | |
| this.spam = this.spam ? this.spam : {} | |
| if (m.sender in this.spam) { | |
| this.spam[m.sender].count++ | |
| if (m.messageTimestamp.toNumber() - this.spam[m.sender].lastspam > 4) { | |
| if (this.spam[m.sender].count > 3) { | |
| global.db.data.users[m.sender].banned = true | |
| this.relayMessage(m.chat, { reactionMessage: { key: m.key, text: '⚠️' }}, { messageId: m.key.id }) | |
| } | |
| this.spam[m.sender].count = 0 | |
| this.spam[m.sender].lastspam = m.messageTimestamp.toNumber() | |
| } | |
| } | |
| else | |
| this.spam[m.sender] = { | |
| jid: m.sender, | |
| count: 0, | |
| lastspam: 0 | |
| } | |
| } |