Update:
The npm have been updated to work with the newest update of discord.js v12!
Note: If the bot have muted someone for 10min, 4min have passed then randomly the bot went offline, do not forget to remove the role from user once the rest 6min are gone or the it's muted forever! (will modify this later)
Additional note: This version 2.0.0 is made to work with the discord.js version 12 and only that, if you try to use it with other version (lower obv), it won't work. For that, get version 1.0.6 and do not forget to fix the channel log to be "antispam-logs".
Any other issues, please open it on Github!
better-discord-antispam.js
A simple module based on Michael Scofield's module: discord-anti-spam.js! While containing the same efficiency(quick and simple setup), it comes with new things like setting up a report channel, timed mutes(removed ban option and added mute & unmute automatically) and many more features coming on the way!
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 better-discord-antispam
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 = ;const antispam = ; // Requiring this module.const client = ; client; client
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...
;
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
<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
- Variable that defines require('better-discord-anti-spam')
<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
maxDuplicatesWarning
- Optional, Type: Integer
maxDuplicatesMute
- Optional, Type: Integer
ignoredRoles
- Optional, Type: Array
ignoredMembers
- Optional, Type: Array
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.
P.S: If you have any issues, bugs or trouble setting the module up. feel free to open an issue on Github
P.S 2: This is just a release that is modified by me to suit the best my needs. If you find it on your taste, I'm happy. I'm not about to add complicated things only if I need them.
P.S 3: Remember if you don't get any notification in #antispam-logs, that means you haven't added with lowercase the name of logchannel in config (this is because discord channels cannot have uppercase for some reasons but voice channels can.)