Skip to content

Discord Bot to automatically ban a user whose username contains a specific string.

Notifications You must be signed in to change notification settings

Rikj000/Discord-Auto-Ban

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord AutoBan

ICONOMI - The world’s largest crypto strategy provider Buy me a Coffee as a way to sponsor this project!

Discord Bot to automatically ban a user whose username contains a specific string.

Originally made by @Whismirk to counter the spam of bots pointing to h0nde (Twitter)
Improved by @Rikj000 to counter the spam of bots pointing to the MoniGoMani (Discord)

Requirements

  • If you don't have it yet, install python.
  • Install discord.py via pip (guide here).

Usage

  • If you don't have a dev app yet, create one on https://discord.com/developers/applications/.

  • Create a bot for your app. Save its token for later.

  • Grant privileged gateway intents to your newly made bot (just tick the options).

  • Invite the bot on your server, with appropriate permissions (namely, read and ban).

  • Then, in autoban.py, configure the SETTINGS section to your needs:

    • You can get user_ids by going into your Discord settings => Advanced => Enable Developer Mode.
    • Then right click on a user and at the bottom of the options menu you will be able to copy the user_id.
    # === ↓ SETTINGS ↓ ============================================================
    target_strings = [
        'verification',
        'your_server_name_here',
        'your_moderator_name_here',
        'your_moderator_name_here',
        'whatever_other_words_that_need_banning',
    ]
    
    whitelisted_user_ids = [
        123456789123456789,  # your_moderator_user_id_here
        123456789123456789,  # your_moderator_user_id_here
    ]
    
    ban_reason = 'Verification, the server name or moderator names are not allowed in the username to prevent scammers.'
    bot_token = 'your_bot_token_here'
    kick_instead_of_ban = False  # set to True to kick users instead of banning
    # === ↑ SETTINGS ↑ ============================================================
  • Finally, run autoban.py inside your terminal of choice. (The bot will only work while the script is running)

  • Optional: A Dockerfile has been added to make running with docker possible 🙂

About

Discord Bot to automatically ban a user whose username contains a specific string.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 87.1%
  • Dockerfile 12.9%