Closed anselal closed 2 years ago
I will look into it for the next update
I'm thinking about creating a update function.
const AntiSpam = require("discord-anti-spam");
const antiSpam = new AntiSpam({
// Anti spam options
});
antiSpam.update({
// new options
)};
I just need to figure out how we gonna add it into the multiple guild option.
I didn't study the multiple guild option yet, but there should be a property for a guildId I guess, or not?
Yes, but the problem is I can add it as the options for guild with id. But then everytime restarting the bot will result in removing cache so also the guild options! Which were updated by the update function
The options should be initialised either with hardcoded default values which restarting the bot won't affect those, or if you change the options on runtime the user must have a way to save the new options (json/db). So this is won't be a problem.
Besides that, restarting the bot for no obvious reason is a no no.
You can update/add/edit/remove bot commands without restarting the bot.
My bot is up and running for almost 3 months and I update it every week without restarting it...
As I removed the abillity to add guild options. This became way easier, I'm gonna work on the system in #159. You can help if you want.
I accomplished this by initializing the antiSpam object with "let" instead of "const". Then I could make a command that would allow you to reassign antiSpam to a new AntiSpam object with new settings. Seems to be working so far.
That being said, very excited for an update options method instead!
It would be nice to be able to update the configuration on runtime. Since we instantiate an object we could add a function to update all the properties on runtime. Also getters/setters for each individual property would be a nice addition.
Is this something you could easily add ? I am not very handy with JS but i could give a hand if needed