MirageZoe / better-discord-antispam

Repository for [BDAS]Better Discord AntiSpam
Other
13 stars 13 forks source link

I have no idea how to use this in my code. #8

Open ColdtQ opened 4 years ago

ColdtQ commented 4 years ago
    prefix
} = require("../../botconfig.json");
const {
    Collection
} = require('discord.js')
const antispam = require('better-discord-antispam')
module.exports = async (client, message) => {
    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: "if you don't stop from spamming, I'm going to punish you!", // Message you get when you are warned!
        muteMessage: "was muted since we don't like too much advertisement type people!", // Message sent after member X was punished(muted).
        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: ["Mavis#2389"], // These members are directly affected and they do not require to have the role above. Good for undercover pranks.
        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: 1000 * 600, // This is how much time member X will be muted. if not set, default would be 10 min.
        logChannel: "antispam-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.
      });
    client.emit('message', msg => {
        message.channel.send('stest')
    })

    const args = message.content.slice(prefix.length).trim().split(/ +/g);
    const cmd = args.shift().toLowerCase();

    if (!message.content.startsWith(prefix)) return;
        const commandfile = client.commands.get(cmd) || client.commands.get(client.aliases.get(cmd))
    if (commandfile) commandfile.run(client, message, args);
}
ColdtQ commented 4 years ago

I try using this in my code but it always errors a bunch

Nailed-it1 commented 4 years ago

const Discord = require('discord.js'); const antispam = require('better-discord-antispam'); const client = new Discord.Client();

client.on('ready', () => { 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: "if you don't stop from spamming, I'm going to punish you!", // Message you get when you are warned! muteMessage: "was muted since we don't like too much advertisement type people!", // Message sent after member X was punished(muted). 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: ["Mavis#2389"], // These members are directly affected and they do not require to have the role above. Good for undercover pranks. 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: 1000 * 600, // This is how much time member X will be muted. if not set, default would be 10 min. logChannel: "antispam-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. });

});

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

})

this mb? this works for me

r1zyn commented 3 years ago

Doesn't work for me, nothing happens.