Share This Post

Featured News / Featured Slider / General / Main Slider

Twitter Can Fix Twitter With Just a Few Lines of Code

Twitter Can Fix Twitter With Just a Few Lines of Code

Hey friends, heads up – I provide links in this post. They provide context.

I stumbled across a really interesting article by Charlie Warzel over on Buzzfeed this morning. It was titled “A Honeypot For Assholes”: Inside Twitters 10-Year Failure to Stop Harassment. One of the key things noted in the article – for me anyway – was the following “If Twitter had people in the room who’d been abused on the internet when they were creating the company, I can assure you the service would be different”. That’s something I totally get as someone who’s been targeted, harassed, and abused by Twitter troll accounts endlessly for many years, some of them the same sad individuals persistently, no, relentlessly for nearly seven years and counting. I’ve blogged about a few of these stains on humanity more than once on this very site.

So this Charlie Warzel article and the insight it gave me got me to thinking.

We all know the old ‘cure-yourself-of-all-trolls’ adage – “Don’t feed the troll’. Well, I can testify that with some of these fucking losers that will never work. To understand why and to understand how to remedy, you have to get into the psyche of the persistent Troll.

The persistent troll isn’t like other trolls. It is obsessive, even though it doesn’t know you, has never met you, it thinks it can constantly harass you and anyone it thinks it can convert to it’s way of thinking. Most often the reasons for this behavior stem from jealousy, narcissism,  ‘it shoulda been me syndrome’, a complete lack of self-awareness, a lack of control over their own life situation, and not being breast fed by whatever fucked up creature spawned them. Not in that order.

The primary aims of a persistent troll are three-fold:

  • Insert themselves into every conversation you initiate or are part of.
  • Convince other people they deem ‘friendly’ to you that YOU are the asshole – especially credible other people.
  • Run you off ‘their’ internet. Remember they’ve been doing this years. You ain’t their first target.

Once you realize this, you’ll also realize that Twitters ‘block and mute’ features are totally ineffective in their current form. You see the persistent troll knows they are only gonna be able to fire off one or two abusive tweets and you will likely just block on contact. They don’t care whether you engage them or not, their sole aim, which in 99% of the assholes that come at me is driven by follower-count jealousy, is to get as many people as possible to hear their deranged rantings and flood your timeline with themself. So they constantly ‘@’ your handle, as if trying to ‘recruit’ your hard earned followers into their twisted dark side. Blocking them, as it stands, does not prevent this.

Some of them, when blocked, even claim that was their original goal and class it as a ‘win’ of some kind, like a badge of honor, but then continually keep ‘@ing’ your handle, in many cases for LITERALLY YEARS even with zero interaction or acknowledgement from myself. A while back I developed a quick flowchart for this particular species of persistent troll. It’s right here – start from the upper right- (click to enlarge):


Where then lies the answer?

Well, Twitter have been wasting time and resources developing algorithms for the purpose of ‘detecting’ abuse, and they just aren’t working. Combine that with Twitters stupid-ass policies on:

What Twitter should do is take the power from the abuser and give it back to the abused. It’s not Twitters job to figure a way to automatically determine what I or you as individuals are willing to put up with. Twitter can eliminate persistent (and non-persistent) trolls in just a few lines of code. The code would have nominal (if any) detrimental performance effects and once implemented would require no further interventions from the ‘IRL fight me mutherfucker’ adjudication staff Twitter already have in place to deal with this bullshit. Twitter users could have a troll-free environment and they could have it right now ….

(I’ve done it in ‘pseudo code’ for illustration purposes):


What does this mean?

Simply put. If Jim is blocked by John, Jim can no longer even utter Johns handle/twittername in a tweet. If he attempts to the tweet simply doesn’t process or gets sinkholed. Period. The end. Forever, or until John unblocks him. This approach would not infringe on Jim’s ‘freedom of speech’, he can still say whatever he likes, but he can’t include John. This approach would be self-policing essentially allowing users to decide if they are being abused or harassed and allowing them to take immediate actions without relying on Twitter to minimize the problem effectively. This approach would not be an overhead on Twitters current infrastructure and would require NOTHING by way of extra storage capacity.

The above ‘pseudo code’ snippet would catch any word after the ‘@’ sign and sinkhole the tweet if the user has them blocked. This would also prevent them from replying to the victim via a direct tweet link. Futhermore, the code could easily be refined to extrapolate the victims unique Twitter numerical ID and ensure the troll is unable to mention that too, thus preventing them from linking to any tweet you ever posted, or your profile. Basically it turns the ‘block’ feature into what it always should have been: ‘Persona Non Grata’.

But I’m not gonna break my neck over this. I don’t work for Twitter. <sarcasm> I wouldn’t wanna tread on toes </sarcasm>

Real world analogy. If I’m walking down the street, and some fucking froot loop gets all up in my grill, I can:

  • a). Throat punch him.
  • b). Remove myself from the situation.
  • c). Go home, close my door.
  • d). Get a restraining order.

Or E, all of the above, but either way I don’t have to listen to his shit. Currently Twitter provides no way for you to prevent a persistent troll from harassing you or your followers. Yes, yes I know the perp could just create a new account dedicated to making your life hell, but they do that anyway, just block ’em again – then they can’t mention your handle. Trolling people needs to be made harder for the troller, and easier for the trollee to avoid.

You can have a troll-free Twitter experience and you can have it RIGHT NOW. Twitter can fix it – if they want to.

It’s not rocket salad. Wouldn’t it be something if Twitter led the way with actions not words against the troll epidemic that is consuming all social media platforms?

Or is it that Twitter doesn’t want to fix beyond what they’ve already got and they’re happy with millions being trolled into silence? Or worse.

Remember NO MEANS NO.

That said I don’t actually hold much hope that they will even read this since they won’t verify me or respond to any abuse tickets I submit because as far as they are concerned I am ‘not a real person’. (I know right??).

So there, I said it.

Have a troll-free evening.

PS: You can subscribe/unsubscribe to my blocklist of currently 4480 Twitter shitheads right here.

All part of the service.



Share This Post

Profile photo of JΞSTΞR ✪ ΔCTUAL³³º¹
Proud infidel. Cyber Minuteman ● Listed in TIME Magazine 30 Most Influential People on the Internet ● My laptop is exhibited in the International Spy Museum, DC


  1. Profile photo of Capt BlackEagle

    Well put, and so easy there is no way that they could collectively think of it.

  2. Profile photo of Laurie Lamb

    Your idea is brilliant. And I loved reading your ‘pseudo code’!

  3. Profile photo of D

    Great post J.

  4. Very well said. Let the people police the people and not leave it up to Twitter, by allowing me to block someone they can’t abuse me to others with my handle.

  5. So how to we pressure them to finally do it? I am personally tired of the Bias algorithm that is obviously in play.

  6. Profile photo of Liberty Speaks

    Your solution to the troll problem on Twitter is concise and elegant. Effectively it gives power back to the individual who is being targeted instead of the leaving it up to the collective powers that be. Too many times harassment needs some form of interpretation in order to be taken seriously, and like beauty, what is abuse to one, is not abuse to another. This simple fix allows the the individual to decide for themselves what they will and will not tolerate…as it should be. Kudos J!

  7. Profile photo of ckay

    “tweet not sent because you’re an asshole” made me laugh.
    Great post as always.

  8. I’m sure there must be SOME reason why this type of coding hasn’t been implemented already…………….??

  9. Profile photo of Katerine

    The pseudocode is lovely. The truly brilliant are able to see the simplest solutions in addition to the complex.

  10. Profile photo of Scott Kindorf

    An interesting add-on to that well-done snippet of pseudocode would be for there to be some kind of table-value kept, whereas n+1 times that $tweetsender uses $tweetRecipient beyond a fixed number (say, 10), that $tweetsender is now blocked from sending *anything* on the platform or API, regardless of method & from IP address (preventing socks), for 2 hours. This would prevent “extended assholery” by sending a more clear message to the user. Similar to a g-line or k-line on IRC (Well, maybe not a K-line, since you could still log-on to the platform)

    Please take into account that I’ve been a root admin for what once was a very large IRC Network and take *zero* crap from asshats.

  11. Nice, so while I am blocked on your TL, I can post to your site, Talk ‘about double standard. If properly reason, your thinking would have encapsulated itself in your code, as I have already, many eons ago have been blocked from your Twitter. Of no ill feelings really, sometimes, we are all moody. However, to then be determined: One of 4480 Twitter shitheads.

    Well, I disagree.

  12. “Simply put. If TrumpCritic is blocked by Trump, TrumpCritic can no longer even utter Trump’s handle/twittername in a tweet. If he attempts to the tweet simply doesn’t process or gets sinkholed. Period. The end. Forever, or until Trump unblocks him. This approach would not infringe on TrumpCritic’s ‘freedom of speech’, he can still say whatever he likes, but he can’t include Trump.”

    Does this still sound like a good idea to you? 😉

  13. Profile photo of Cesar

    I gonna write a paper about the guy who wants to tweak twitter for the better even tho they wont verify his account.

  14. I realize this is a bit late to the game, but J – have you seriously considered your own “twitter-like” coding/app? I’m sure it must have passed through the neurons at some point; just wondering why this hasn’t become a reality. Secure code, ease of use, popularity……. what am I missing?

  15. Profile photo of mradamdavies

    For an uber hacker, your code is janky…
    if ($ini == 0) return ‘ ‘;
    should be…
    if ($ini === 0) return ‘ ‘;


  16. Thank you, J ~ I was reluctant to use Twitter for this very reason ~ so kudos for calling them out w/an easy fix. However, why wait for Twitter to take you up on it? An app/extension is much quicker/easier to use in a browser.

    Frankly, I miss the old networks where interested people interacted politely about topics like investments, graphic art, etc. I learned how to create a moving icon for a signature while enjoying the creative works of graphic artists. I guess that ages me, but our society in general has gone off the “interaction rails” socially with rampant abuse & coarseness no matter the media. So, I appreciated reading the comments on your blog & will be back. In the meantime, I am following you on Twitter.

    Chao ~ Moms Hugs aka Eve (No actual hugs unless I know you.) (haven’t posted for long while)

  17. PS: I see a typo, but no edit option. Could you please correct “Chao” to “Ciao!” for me? Thanks.

Leave a Reply

Lost Password


SANS REPORT: Jester Dynamic