Skip to content

Instantly share code, notes, and snippets.

Created May 4, 2018 08:05
  • Star 45 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
killabot v1 (wip)
# Requirements: pip install tweepy fuzzywuzzy python-Levenshtein
import tweepy
import re
from fuzzywuzzy import fuzz
# Credentials go here (generate at:
auth = tweepy.OAuthHandler('consumer_key', 'consumer_secret')
auth.set_access_token('access_token', 'access_token_secret')
# Connect to Twitter
api = tweepy.API(auth)
# Grab last 200 mentions
mentions = api.mentions_timeline(count=200)
# Loop through the mentions
for tweet in mentions:
# Calculate simple Levenshtein distance ratio (non-alpha characters stripped with regex)
ratio = fuzz.ratio("Your Profile Name Here", re.sub(r'([^\s\w]|_)+', '',
# If the ratio is > 80 and followers below 100, report the user
if ratio > 80 and tweet.user.followers_count < 100:
# Submit the report
report = api.report_spam(, screen_name=tweet.user.screen_name)
# Feedback with report
print("Reported: " + tweet.text + " - " + tweet.user.screen_name)
Copy link

For "Your Profile Name Here", make sure it's your profile name and not your screen name. For instance, mine is "Jackson Palmer"

Copy link

ummjackson commented May 31, 2022

What a blast from the past. Instructions I used to provide people via Twitter/email when I shared this gist with them:

  1. Install dependencies by running command in first line
  2. Schedule a cron (or preferred scheduler) job to execute the Python script every 60 seconds

Copy link

I just found this off Reddit, and I think it's funny, the name of this. Based off my internet handle, I named a Discord bot I run "Killabot," and it's also written in Python. What a co-incidence, lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment