I created Twitter bots for my personal account at https://twitter.com/freelancerchamp. I used the Twitter Developer API. It can be accessed by creating an account at https://developer.twitter.com.
I have designed three separate bots that run simultaneously:
- bot that creates tweets.
- bot that likes tweets.
- bot that retweets tweets.
Using panda I read the csv file and iterate through it row by row.
Apart from the csv file index, I have a separate one that I write on a file called tweet_index.txt.
Whenever the bots creates a tweet, it updates the index and overwrite the tweet_index file, such that if I stop the program and rerun, it will start from where it was left, instead of starting from the beginning everytime.
Checks if the tweet is smaller than 280 characters(twitter limit) and create the tweet using the api.update_status command. Then a time sleep of 6 hours between each tweet is applied.
I have a search array that contains random words from the programming lexicography.
Then generates a random word from that array. Loops through all the tweets that contain the random word. Checks if its mine or if it has been liked previously.
If it was not, then checks the tweet score using TextBloB. If the score is higher than 0.5, then the bots likes the tweet.
This cycle is repeated infinitely such that every 10 tweets, the random word changes. After the bot liked one tweet, a delay of 6 minutes is applied.
Then generates a random word from that array. Loops through all the tweets that contain the random word. Checks if its mine or if it has been retweeted previously.
If it was not, then checks the tweet score using TextBloB. If the score is higher than 0.5, then the bots reteets the tweet.
This cycle is repeated infinitely such that every 10 tweets, the random word changes. After the bot retweeted one tweet, a delay of 6 hours is applied.