❓ discordjs-antispam
A simple module with quick setup and different options to implement anti-spam features in your bot.
This version of the package will only support discord.js v13
⚠️ This package support multi-guilds !
📥 Installation
To install this module type the following command in your console:
npm i @devraelfreeze/discordjs-antispam
⬇️ Examples
Example of a basic bot handling spam messages using this module.
const Discord = require("discord.js");
const client = new Discord.Client({
intents: [Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MESSAGES],
});
const AntiSpam = require("@devraelfreeze/discordjs-antispam");
const antiSpam = new AntiSpam(client , {
customGuildOptions: false,
warnThreshold: 4,
muteThreshold: 6,
kickThreshold: 8,
banThreshold: 10,
maxInterval: 2000,
warnMessage: "{@user}, Please stop spamming.",
kickMessage: "**{user_tag}** has been kicked for spamming.",
muteMessage: "**{user_tag}** has been muted for spamming.",
banMessage: "**{user_tag}** has been banned for spamming.",
maxDuplicatesWarning: 6,
maxDuplicatesMute: 8,
maxDuplicatesKick: 10,
maxDuplicatesBan: 12,
ignoredPermissions: ["ADMINISTRATOR"],
ignoreBots: true,
verbose: true,
ignoredMembers: [],
unMuteTime: 10,
removeMessages: true,
modLogsEnabled: false,
modLogsChannelName: "CHANNEL_ID",
});
client.on("ready", () => console.log(`Logged in as ${client.user.tag}.`));
client.on("messageCreate", async (message) => {
await antiSpam.message(message);
const contain_badWord = await antiSpam.message_wordfilter(message);
const badWordsArray = await antiSpam.message_badWordsUsages(message);
});
client.login("VERY SECRET TOKEN HERE :)");
Example of Multi-Guilds
const Discord = require("discord.js");
const client = new Discord.Client({
intents: [Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MESSAGES],
});
const AntiSpam = require("@devraelfreeze/discordjs-antispam");
const antiSpam = new AntiSpam(client, {customGuildOptions: true});
client.on("ready", () => console.log(`Logged in as ${client.user.tag}.`));
client.on("messageCreate", async (message) => {
const guildOptions = {
warnThreshold: 4,
muteThreshold: 6,
kickThreshold: 8,
banThreshold: 10,
maxInterval: 2000,
warnMessage: "{@user}, Please stop spamming.",
kickMessage: "**{user_tag}** has been kicked for spamming.",
muteMessage: "**{user_tag}** has been muted for spamming.",
banMessage: "**{user_tag}** has been banned for spamming.",
maxDuplicatesWarning: 6,
maxDuplicatesMute: 8,
maxDuplicatesKick: 10,
maxDuplicatesBan: 12,
ignoredPermissions: ["ADMINISTRATOR"],
ignoreBots: true,
verbose: true,
ignoredMembers: [],
unMuteTime: 10,
removeMessages: true,
modLogsEnabled: false,
modLogsChannelName: "CHANNEL_ID",
};
await antiSpam.message(message, guildOptions);
const contain_badWord = await antiSpam.message_wordfilter(message, guildOptions);
const badWordsArray = await antiSpam.message_badWordsUsages(message);
});
client.login("VERY SECRET TOKEN HERE :)");
⚙️ AntiSpam Client Options
// TODO
⏳ TODO
- ✅ Add and Test:
Words Filter System
(Can configure the words list to filter) - Add and Test:
Discord Anti Links System
- Add and Test:
Anti Links System
(Can configure links to filter) - Add and Test:
Mass Mentions System
- Add and Test:
Emojis excessifs System
- ✅ Bypass Bots for All Systems (Can be enabled or Disabled)
- Finish the Example for README.md
- Take screenshots of the module and add them to the README.md
- Complete ⚙️ AntiSpam Client Options
- ✅ Find a method to clear cache for a guild when the cache is too big.
- Create docs for the module
📷 Screenshots
// TODO
🐛 Bug Reports
If you have any bugs or trouble setting the module up, feel free to open an issue on Github Repository
If you want more support, you can contact me on Discord: Freeze#0123
🗃️ Old Versions
If you want to use old version, you can use command
npm i @devraelfreeze/discordjs-antispam@<version>
📝 License
Copyright © 2022 devRael1
This project is MIT licensed.
This is not an official Discord product. It is not affiliated with or endorsed by Discord Inc.