2.0.1 • Published 5 years ago

@satont/spamnya v2.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Spamnya

A spam detector for discord.js bots


Installation

npm i satont/spamnya

Usage

CommonJs

  const { Client } = require('discord.js')
  const spamnya = require('spamnya')
  const client = new Client()

  client.on('message', (message) => {
    //initiate the detector and log the chats with max 50 logged chats
    spamnya.log(message, 50)

    if (spamnya.tooQuick(3, 1000)) {
      // when someone send 3 chats in less than a second
    }

    if (spamnya.sameMessages(3, 60000)){
      // when someone send 3 identical chats within a minute
    }
  })

ES6 modules:

import spamnya from 'spamnya'
import { Client } from 'discord.js'
const client = new Client()

client.on('message', (message) => {
  //initiate the detector and log the chats with max 50 logged chats
  spamnya.log(message, 50)

  if(spamnya.tooQuick(3, 1000)) {
    // when someone send 3 chats in less than a second
  }

  if(spamnya.sameMessages(3, 60000)) {
    // when someone send 3 identical chats within a minute
  }
})

Credits

Original author is rainqubit. Repo: https://github.com/rainqubit/spamnya