Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added anti-bot cog #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SohamGhugare
Copy link
Contributor

Anti-bot cog -> Checks for invite links in user's name/nick when they join or update their nickname after joining and kicks them accordingly. Also made it so it will loop thru all the members in the server when the bot is restarted so any members left out while the bot is offline will be kicked instantly.

@BobDotCom BobDotCom self-requested a review August 25, 2021 14:34
Copy link
Member

@BobDotCom BobDotCom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple changes would be good here

  1. make a general function, maybe like await check_user(user) and invoke that in each event. This would make the code much shorter
    @commands.Cog.listener()
    async def on_member_update(self, before, after):
        await check_user(after)
  1. in your checks, it would be easier to move this code into general.py and use the check_invite function. It filters links better.
async def check_user(user):
    if await check_invite(user.display_name):
        # Take action here, user has a bad name
        pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants