Comments (10)
your using it the wrong way too LOL, You have the settings in a other function, Keep the settings outside both and tada, READ THE EXAMPLES KID
you're*
If you're going to be unprofessional, do it properly.
from discord-anti-spam.
your using it the wrong way too LOL, You have the settings in a other function, Keep the settings outside both and tada, READ THE EXAMPLES KID
from discord-anti-spam.
just read the examples on the npmjs.org site
from discord-anti-spam.
I can’t have the settings on the outside because I require the guild ID
from discord-anti-spam.
@CalebDelbridge you can use something like that:
const AntiSpam = require('discord-anti-spam');
let AntiSpamClients = {};
client.on("message", async message => {
let antiSpam = AntiSpamClients[message.guild.id];
if(!antiSpam){
let warnThresholdSetting = client.guildSpamSettings.get(message.guild.id, "warnThreshold")
let kickThresholdSetting = client.guildSpamSettings.get(message.guild.id, "kickThreshold")
let banThresholdSetting = client.guildSpamSettings.get(message.guild.id, "banThreshold")
let maxIntervalSetting = client.guildSpamSettings.get(message.guild.id, "maxInterval")
let maxDuplicatesWarningSetting = client.guildSpamSettings.get(message.guild.id, "maxDuplicatesWarning")
let maxDuplicatesKickSetting = client.guildSpamSettings.get(message.guild.id, "maxDuplicatesKic")
let maxDuplicatesBanSetting = client.guildSpamSettings.get(message.guild.id, "maxDuplicatesBan")
antiSpam = new AntiSpam({
warnThreshold: warnThresholdSetting, // Amount of messages sent in a row that will cause a warning.
kickThreshold: kickThresholdSetting, // Amount of messages sent in a row that will cause a ban.
banThreshold: banThresholdSetting, // Amount of messages sent in a row that will cause a ban.
maxInterval: maxIntervalSetting, // Amount of time (in milliseconds) in which messages are considered spam.
warnMessage: '{@user}, Please stop spamming.', // Message that will be sent in chat upon warning a user.
kickMessage: '**{user_tag}** has been kicked for spamming.', // Message that will be sent in chat upon kicking a user.
banMessage: '**{user_tag}** has been banned for spamming.', // Message that will be sent in chat upon banning a user.
maxDuplicatesWarning: maxDuplicatesWarningSetting, // Amount of duplicate messages that trigger a warning.
maxDuplicatesKick: maxDuplicatesKickSetting, // Amount of duplicate messages that trigger a warning.
maxDuplicatesBan: maxDuplicatesBanSetting, // Amount of duplicate messages that trigger a warning.
ignoreBots: false, // Ignore bot messages.
verbose: false, // Extended Logs from module. warnEnabled: true,
warnEnabled: true,
kickEnabled: true,
banEnabled: true
});
AntiSpamClients[message.guild.id] = antiSpam;
}
antiSpam.message(message); // it works!!
});
from discord-anti-spam.
@Androz2091 for some reason it wont work with the variable names but when I input numbers directly it does work I have no idea whats going on here
from discord-anti-spam.
And it worked with your old code?
from discord-anti-spam.
No what I meant is that when I remove the client.guildSettings variables and just input numbers it works fine but when I use the variable names it does not
from discord-anti-spam.
Can you print the result of those calls in the console? like that:
let warnThresholdSetting = client.guildSpamSettings.get(message.guild.id, "warnThreshold")
console.log(warnThresholdSetting);
for each setting
from discord-anti-spam.
Here you go:
let warnThresholdSetting = await client.guildSpamSettings.get(message.guild.id, "warnThreshold")
let kickThresholdSetting = await client.guildSpamSettings.get(message.guild.id, "kickThreshold")
let banThresholdSetting = await client.guildSpamSettings.get(message.guild.id, "banThreshold")
let maxIntervalSetting = await client.guildSpamSettings.get(message.guild.id, "maxInterval")
let maxDuplicatesWarningSetting = await client.guildSpamSettings.get(message.guild.id, "maxDuplicatesWarning")
let maxDuplicatesKickSetting = await client.guildSpamSettings.get(message.guild.id, "maxDuplicatesKick")
let maxDuplicatesBanSetting = await client.guildSpamSettings.get(message.guild.id, "maxDuplicatesBan")
console.log(warnThresholdSetting)
console.log(kickThresholdSetting)
console.log(banThresholdSetting)
console.log(maxIntervalSetting)
console.log(maxDuplicatesBanSetting)
console.log(maxDuplicatesKickSetting)
console.log(maxDuplicatesWarningSetting)
3
7
7
2000
12
10
7
from discord-anti-spam.
Related Issues (20)
- banAdd event and kickAdd event returns null HOT 4
- None of this is working, I have downloaded the npm. Idk why HOT 1
- The link for the documentation is invalid. HOT 2
- Gives "Could not ban becauae of improper permissions" error in chat even on successful ban. HOT 4
- ON/OFF HOT 10
- Code Error HOT 1
- Unmute? HOT 2
- Default values in AntiSpamClientOptions constructor broken
- Error when the bot deletes spam. HOT 3
- DiscordAPIError: Unknown Message HOT 1
- Docs not there HOT 2
- Work with discordjs v13 ? HOT 9
- DiscordAPIError: Unknown Message HOT 21
- BitField Error HOT 3
- DAntiSpam (clearSpamMessages#failed) & (warnUser#sendSuccessMessage) HOT 2
- Add the ability to update configuration on runtime HOT 7
- Error: "TypeError: Cannot read properties of undefined (reading 'id')"
- Option to watch for cross-posting HOT 2
- Discord-anti-spam not deleting the spam messages and not assigning mute role HOT 12
- Can you make it so I can add embeds? HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discord-anti-spam.