Giter Club home page Giter Club logo

antiscambot's People

Contributors

dependabot[bot] avatar socksthewolf avatar user4752 avatar wong-michael avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

antiscambot's Issues

Create automated testing

It would be great to have a series of unit tests built in that could be ran and validated against. I'm not aware of any python unit test frameworks and their functionalities, so this would require a bit of research.

Scope of task is as follows:

  • Find unit test library to use
  • Create bot in discord developer center for just testing
  • Implement multiple unit test cases (see below)
  • Create testing folder for handling said tests

Tests to run:

  • Command sent for banning
  • Command sent for unban
  • Banning in a server
  • Banning without permissions
  • Invalid input checking
  • more as necessary

On finish of this task, a creation of a new task to have the system automate a test run on python commits/merge requests should be made.

This task should wait until #3 is completed, and probably should wait until #28 is too

Add a command that allows for reporting outside of the control server

Goal: Implement a Discord modal that allows for moderators to report commission scams without having to be in the control server. This can be brought up by any user with the administrator or ban permission.

This would direct the correct information to the TAG control server, by making a reported post. There would be a significant server wide cooldown implemented as well to prevent users from abusing it.

DM server owner to activate after bot addition

If the bot gets added to a server but not activated after a set amount of time, dm the server owner to tell them about activation (if they are not already in the control server).

We can use a couple of checks to make this not invasive nor annoying.

Docs: SEO tags are not getting properly liquified

This might work if we change the tag replacement code to be proper liquid eg {{ site.bot_name }}, but would require some investigation on if the Jekyll-seo project will handle these.

Right now, any link cards show the default string site.bot_name due to github not supporting the liquify plugin.

Create list of EnvVars used

This should be done to make it clear for anyone that decides to spin up an instance of the bot, what flags they need to set to have a working instance

Check bot role during bans with permission errors

Currently, we have a standard error if we cannot execute the ban on a scammer due to permissions.

The problem with this standard error is that we don't know if we can't execute the ban because we lost ban permissions, or if the scammer in question is in the server with a role higher than ours.

The goal of this task is to see if we can detect if the issue is due to a role ranking difference without bringing in the server members nor the presence intents, as both intents are special and require extra permissions that I rather not add (see Discord's principles of least privilege).

Plus the fewer permissions we use, the better we are off.

Add confirmation on ban action

Summary: When the destructive action is attempted to be performed, show the calling user a ui model (discord.ui.View) that gives the option to ban.

When it should run:

  • The caller of the command has permission to execute
  • The target scammer id is valid
  • The target scammer is not already in the database

What information should it show:

  • all the information that gets generated in the current discord.Embed generator function
  • account age
  • bio?

Actions that can be performed:

  • Button to confirm the ban
  • Button to close the model view (Cancel). This only just closes the view and does nothing else

Note: to avoid race conditions, we should make sure that we check if the user is already banned in the database before the ban operation is performed. This action is already done asynchronously, so this addition to the code could introduce a new issue.

Remove from database if bot is kicked

If the bot is kicked while it is running from a discord server, we should remove it from our activated list. This is needed to be implemented for #9 to be put into place.

Setup dependency updates/freezing

Currently, we just use whatever is the latest of these packages, but that can be an issue if any of our requirement modules has a major update. The goal is to update our requirements file so that it freezes properly.

Goals:

  • Freeze the requirements file to the current latest versions
  • Set up dependabot yml file to make sure that we are properly updating these modules.
  • Have a github deploy action do a pip update whenever the requirements.txt updates

Lower down logging of permission issues via better checks

During reprocessing of bans, we should check that we have the permission to ban/unban.

This can be done by having the bot check during activation/deactivation if the permission was granted. If not, then potentially send an error message back when trying to activate instead of responding with the success message.

Update documentation on commands

Currently there is no documentation regarding the new scamguard slash commands for reporting/checking bans. This should be properly documented on the website!

Make command to ban any discord ids mention in thread OP post

This would, via a command, scan the thread for a discord id (in the title or body of the post) and then get it ready for a scam ban. This would be easy to implement, and be helpful for mobile users.

To get the thread title:
Check the channel type, if it's a typeof Thread, then you can just use the name property and it will give you the title in plain text.

To get the first post, we would have to read the message history.

Combine PrepareBan/Unban into a shared function

Goal: right now these functions seem to share similar code with the only difference being the flag of the async operation and some naming and returns.

Create a new function that handles a ban/unban based on a single bool flag, to help lower potential code duplication.

Sub-instance activation permissions issue

Logging this here but it appears that /activate may not properly work for moderators in servers where the bot was invited. This is likely a permissions lookup issue that needs to be resolved.

It works correctly for owners, likely meaning it is a permission issue.

Change the ban reasons

Right now it says "reported scammer by XXXXXX", it should say something along the lines of "Confirmed scammer by XXXXXX".

These ban messages are handled in the DiscordBot.py file.

Update scamcheck with new permissions

Scamcheck is currently a global command. This is great, however, this means that anyone outside of the control server can do a scamcheck lookup even if they are not a moderator.

Prepare for migration to other cloud services

Currently we are on digital ocean. This is fine, but because we are python, memory is going to start jumping up overtime. Currently, DigitalOcean counts the memory usage of the OS against you, which is less than ideal because the OS uses about 30% of the 512MB plan we are on (verified via top before running app)

With 18 servers active and 21 in, we have a total of 38% usage of our RAM.

We are good for the next few months as we have free digital ocean credits, but we’ll want to move to railways as it gives us 8GB of RAM.

This will require the following changes:

  • Some way to find the .env file
  • Env file stores path to config file
  • Update to have file access not be hardcoded (be in config for bans.db)

Eventually, we will want to have the database move over to a db managed instance, but that can be for a different time.

Refactor: Database handling into a new class

Currently database functionality exists in the same class as the discord handling, and it looks like a chaotic mess. We could move the database functionality to another class instead of having it one big one.

Add FAQ explanation for bot permissions

So it might be confusing because the bot requests the read messages role for other servers and some might be adverse to this, even though it does not log nor does it read any message that does not have a ? as the starting character.

Eventually, when we move to the solution in #3, we can switch to the add bot via link instead of clicking on its profile to add, thus significantly lowering down processing (as it will strictly only run those commands in a control server).

Refactor: Separate core functionality from bot code

This calls for moving the code that handles lookups, banning, unbanning and the connection between the discord bot and the database to a new class.

Thus making the bot code solely handle eventing and messaging.

?print can overflow message length

Print commands can overflow the 2000 character limit that Discord enforces onto bot messages.

Get around this by splitting up the message.

Remote reports need to reupload the image to discord

Currently, discord's expiration implementation causes images from remote reports to be wiped after the expiration. This is a problem for reports as it means data can be lost.

We need a way to keep that information.

Allow activation from a server

An issue we've had for awhile now is users will add the bot to their server but then never activate it, so it sits dormant in their server.

We either need to increase messaging with like a first time message that's posted whoever adds the bot if possible to let them know. Slightly related to #23

Add thread link information to ban data

Specifically, this should add either a new few columns into the banned accounts table or should be an entire separate table.

The goal of this is to populate the information with links to report threads (store a list of thread ids, not the actual links). The bot can resolve those thread ids when it generates said embed data.

Refactor: Database Schema

This requires tweaking the database to migrated to one that has better typing/formatting rules. Right now, it's kind of a mess, and even worse if we ever have to upgrade the server.

Look into ways to potentially make this easier to work with that can also build queries. There are a few python libraries that can help.

Changing the name of the bot

Currently, the two names in the system are:

"BEGONE, SCAMMER" and "Commission Scammer Banner".

Both of these names are not very great, and we should probably determine a better name before verification, as that will permanently lock in our bot's user name as per this support article.

Will need to also update the screenshot seen here once names have been chosen.

Allow for assignment of a channel that the bot can post into for discord servers

This allows us to also directly write to the server's moderators whenever something goes wrong and will also let us push updates to tickets too. This would be extremely handy for communication, and responses as well.

Something like this could be accomplished with a /setup command the bot could have that would bring up a custom modal with instructions and assignment.

Queue publish posts

Apparently, you can only have 10 published posts per hour. If we get a banwave, like the one this morning, then some posts will not publish.

We should enqueue those posts to try again in the future.

image

Write privacy policy page

Bot stores minimal info, so we probably don't need to go super wild with this.

The only things that are stored are:

  • Servers activated in
  • Who owns those servers
  • If a user is banned
  • Who banned them
  • When they were banned

And that's really just it. When we go for bot verification, we'll probably need to make sure we have this.

Add sleep functionality while processing heavy lists

This is going to be necessary for scalability eventually. While ratelimiting is already handled, we will want to default sleep after doing several amounts of bans as the lists grow and grow.

This will become more and more important as things move forward.

Make FAQ page

Instead of having it on the bot page, it might be better to separate the FAQ into its own documentation page.

It might just make it easier to find, which users are going to be looking for.

Create a Terms of Service document

Bot verification now also requires getting a terms of service document created for your bot. Information here.

Tasks:

  • Find a good example of said document
  • Create a terms of service document
  • Update the webpage to link to said TOS document

Detect and handle server owner migrations

The database does not update the server owner list so if a transfer happens, then the data in the database is incorrect.

The bot should be able to detect if a discord server migrates owners.

Users with server admin permissions can ?activate

This might not be possible via the API by itself and may require more information from the user, but if the bot was added by someone who is not the server owner, but then they should be also able to ?activate the bot as well.

Look into it

Checking if user accounts are deleted (cleaning up the database)

This will need a way to tell for certain that the person is actually gone vs the discord API is not responding. When we go to activate bans, it doesn't make sense to waste a ban command on an user account that cannot come back (deleted permanently by Discord).

This requires checking to see if the account is deleted, and if so, remove them from the database.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.