npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

discantispam

v3.6.0

Published

A simple module help you to make automoderation very easily

Downloads

1

Readme

Update:

The npm have been updated to work with the newest update of discord.js v13!

Note: If the bot have muted someone for 3hr, 4min have passed then randomly the bot went offline, do not forget to remove the role from user once the rest 90min are gone or the it's muted forever! (will modify this later)

discantispam.js

A simple module based on MirageZoe module. i will add ban, kick and more futures!

DISCLAMER: You can only setup 1 set of configuration per client. (That means that you can't configure settings for each server for now. You can only modify in which guild checker is run and in which checker is not run.)

How to add this to your node_modules:

To install this module type in your console command below:

npm i discantispam

An example of how to set up:

Below you will find an example that would explain everything and what you must set up! (it's not too different!)

const Discord = require('discord.js');
const antispam = require('discantispam'); // Requiring this module.
const client = new Discord.Client();

client.on('ready', () => {
  // Module Configuration Constructor
   antispam(client, {
        limitUntilWarn: 3, // The amount of messages allowed to send within the interval(time) before getting a warn.
        limitUntilMuted: 5, // The amount of messages allowed to send within the interval(time) before getting a muted.
        interval: 2000, // The interval(time) where the messages are sent. Practically if member X sent 5+ messages within 2 seconds, he get muted. (1000 milliseconds = 1 second, 2000 milliseconds = 2 seconds etc etc)
        warningMessage: "Don't spam here", // Message you get when you are warned!
        muteMessage: "was muted",// Message sent after member X was punished(muted).
       kickMessage: "was kicked", //Message sent after member X was kicked from guild!
       banMessage: "was banned", //Message sent after member X was banned from the guild!
        maxDuplicatesWarning: 7,// When people are spamming the same message, this will trigger when member X sent over 7+ messages.
        maxDuplicatesMute: 10, // The limit where member X get muted after sending too many messages(10+).
        ignoredRoles: ["Admin"], // The members with this role(or roles) will be ignored if they have it. Suggest to not add this to any random guys. Also it's case sensitive.
        ignoredMembers: ["507798218059415562"],// These members are directly affected and they do not require to have the role above. Good for undercover pranks.
        ignoreBots: true, //These bots are directly affected and they do not require to have the role above
        ignoredChannels: ["general_chat"], //These channels are directly affected
        ignorePermissions: ["ADMINISTRATOR"], //Who have admin perms are directly affected
		mutedRole: "Muted", // Here you put the name of the role that should not let people write/speak or anything else in your server. If there is no role set, by default, the module will attempt to create the role for you & set it correctly for every channel in your server. It will be named "muted".
		timeMuted: 9000 * 600, // This is how much time member X will be muted. if not set, default would be 90 min.
		logChannel: "mod-logs" // This is the channel where every report about spamming goes to. If it's not set up, it will attempt to create the channel.
      });
      
  // Rest of your code
});

client.on('message', msg => {
  client.emit('checkMessage', msg); // This runs the filter on any message bot receives in any guilds.
  
  // Rest of your code
})

client.login("token");

This is the main setup you have to add in order to protect your server from unwanted people. If they send more than 3 messages within 2 seconds, they get warned. At 5 they get muted. If they send same message 7+ times, he get warned and at 10 muted. Every member from option and everyone that has the role/roles from are protected from system so they can spam as much as they want.

Little bit of documentation...

antispam(<Client>);

This will configure module to run on its default configuration. <Client> - Variable that defines new Discord.Client() antispam - Variable that defines require('better-discord-antispam')

client.emit('checkMessage', <Message>)

<Message> - Variable that defines the message itself. (client.on('message', async (msg) =>{}) in this situation msg is the variable.) This will basically send your message to module. In fact is REQUIERED for module to run.

antispam(client, {
        limitUntilWarn: 3,
        limitUntilMuted: 5,
        interval: 2000,
        warningMessage: "",
        muteMessage: "",
        banMessage: "",
        kickMessage: "",
        maxDuplicatesWarning: 7,
        maxDuplicatesMute: 10,
        ignoredRoles: [],
        ignoredMembers: [],
        ignoreBots: ,
        ignoredChannels: [],
       ignorePermissions: [];
		mutedRole:"",
		timeMuted: 1000*600,
		logChannel: ""
      });

antispam - Variable that defines require('antispam-guard') <Client> - Requiered, Discord.Client limitUntilWarn - Optional, Type: Integer limitUntilMuted - Optional, Type: Integer interval - Optional, Type: Integer warningMessage - Optonal, Type: String, Minimum 5 Characters muteMessage - Optional, Type: String, Minimum 5 Characters kickMessage - Optional, Type: String, Minimum 5 Characters banMessage - Optional, Type: Strint, Minimum 5 Characters maxDuplicatesWarning - Optional, Type: Integer maxDuplicatesMute - Optional, Type: Integer ignoredRoles - Optional, Type: Array ignoredMembers- Optional, Type: Array ignoredChannels - Optional, Type: Array ignorePermissions - Optional, Type: Array ignoreBots - Optional, Type: Boolean mutedRole- Optional, Type: String timeMuted- Optional, Type: Integer logChannel- Optional, Type: String NOTE: The module will throw errors for assigning incorect types to configuration values.