Skelmis / Discord-Anti-Spam

Ever wanted a bot to automatically deal with spammers? This is your Python library for it.
https://dpy-anti-spam.readthedocs.io/
MIT License
76 stars 17 forks source link

Anti Profanity #47

Closed Codeize closed 2 years ago

Codeize commented 3 years ago

Is your feature request related to a problem? Please describe. I think it would be amazing to have anti profanity features in this package, I would like to think of it as an 'all-in-one' package for automoderation in DPY.

Describe the solution you'd like Have a basic anti profanity system, filtering all the usual words. Eventually maybe add a leveling system of filtering. IE: Level 1 - Low (Only filters the worse words.) | Level 3 - Strict (Filters almost all 'bad' words. For example : Damn, Ass, etc etc.)

Additional context Yes, a big feature, but I think it would be well received.

Skelmis commented 3 years ago

The issue would likely be the implementation. In order to cater to multi-language this would need to be a fairly ambiguous system which is drag & drop for people. I do like the idea however, can you expand on the level idea?

Codeize commented 3 years ago

Sure. So users would be able to pick among x amount of anti-profanity 'levels.' The low levels have a considerable amount of tolerance in comparison to the higher levels. The purpose for the higher levels are for the servers who want zero tolerance for any type of bad word. I had in mind that the server admin could change the tolerance level on the fly via a command. I suspect the issue would be filtering these words to the different levels..

Skelmis commented 3 years ago

I suspect the issue would be filtering these words to the different levels..

This is correct. I can think of a way to implement this, and I like the general idea however the levels could be an issue. Do you have any thoughts on an implementation?

Codeize commented 3 years ago

Not particularly. Maybe run tests for machine learning, instead of relying on a wordlist? I'm not all too sure how that would work.. but I've tried using wordlists for my bots and there is always an issue with them, using machine learning may be the key to making this work fluently. It also would catch if a user put a certain character in place of an actual letter in a bad word, (Example: F4ck.) I'm sure you could think of an alternative idea, im just spitting out ideas, let me know what think.

Skelmis commented 3 years ago

I think an ml approach is going to be too heavy on the end user for what it's worth, especially anyone who wants to use it in a context outside of the default one I would provide. Training models takes more data and time then is feasible for most devs looking for plug and play libraries in my opinion.

It will likely be implemented as a tuple/set. Further issues are raised since I would not be including this in the standard library. (I'm making it an extension since it's not 'Antispam' and standard lib is already decently sized and complicated) I need a way to interact with guilds and users in order to track punishment levels without reinventing the wheel. Do you have any ideas?

Skelmis commented 3 years ago

I can ignore the issue if we assume every bad word results in a punishment, but the moment it doesn't and we need to track words said it falls back to said issue. I could take the tracker approach and use a dict, but that's inefficient when we already have these underlying data structures built into the library.

I think I will modify the Guild & User creation code to inject extensions and let extensions specify a method that is invoked every time a new Guild / User object is created.

Big note I need to find a programatic way to fuck with the associated slots variables on classes for this. I don't feel it is worthwhile removing for a minority feature and worse performance

Skelmis commented 3 years ago

This is now up to you. I await a pull request once you have completed it @Codeize :)

The documentation, etc should all become available soon. If you need anything further in any aspect, just let me know

Skelmis commented 3 years ago

It is now my understanding that this falls back to me. This means I find it unlikely it will be completed any time soon.

Skelmis commented 2 years ago

This could be done within the rewrite, the infrastructure changes allow this kind of plugin. I just need to find a nice way / wordlist

Skelmis commented 2 years ago

Given the ambiguous nature of the word list, I am going to close this as any solution would be biased towards a small subset of what end-users could want.

To anyone viewing this, the plugin system will easily let you integrate this into your bot.