I always knew that there were bots on Twitter but I am not sure I had truely gathered just how deep this network goes 🤦
I've been trying to debug a pretty weird issue with one of my own bots on and off for the last week or so and I couldn't work out what was going on.
While it doesn't do a whole lot (it essentially justs retweets storm information to warn people who follow it that there might be storms in the area) this particular bot is relatively popular so I try to keep it somewhat functional.
Recently I noticed that another account was spamming some of the key words that the bot retweets with conspiracy theories. Usually this isn't much of an issue as the Twitter API allows you to filter out tweets from specific users with a query like
I updated my code to exclude the user who was spamming and I expected it would solve the problem pretty much instantly.
Unfortunately, over the next few days I kept seeing tweets from this user showing up in my bots feed 🤔
At first I thought I had messed up my query string but after digging into the logs a little more I could find no tweets from the user that I was trying to exclude at all yet they were still showing up in my bots feed 🤯
After a bunch more testing and a few wtf moments I worked out that somehow tweets from other users were appearing in my bots feed as if my bot had directly retweeted the spam account.
It turns out that my bot was retweeting other users who had retweeted the spam account. Each time I blocked a new user it would immediately be replaced by another retweet and it didn't take long for me to realise that there was a massive network of bots all retweeting the original spam account and my bot had inadvertently joined in on the party.
The eventual solution was pretty simple. All I needed to do was add
-filter:retweetsto my query string but it took a whole lot longer than it should have to arrive at that realisation.
Hopefully this little story prevents someone else from heading down a similar rabbit hole in the future 👍