@satont/spamnya
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @satont/spamnya

Weekly Downloads

0

Version

2.0.1

License

MIT

Unpacked Size

4.37 kB

Total Files

5

Last publish

Collaborators

  • satont