Tool to post daily random tweets for a responsible Twitter bot
- Connect to the Twitter API.
- Tweet from the command-line or using a scheduled cron job.
- Generate a tweet message from your custom lists of messages, emojis and hashtags.
- Search for top tweets about a topic of interest and automatically favorite them.
After configuring auth details and setting up configured content, you can run boris.py script on the command-line. This will generate a random status using configured text files and then post it as a tweet to a Twitter account.
$ ./boris.py
Message:
'Boris is replacing all his internet passwords with passwords of at least 20 characters. #GDPR'
Updating timeline.
See the tweet at: https://twitter.com/boristhebabybot
The unicron repo is recommended for scheduling this project to ensure the bot posts daily as soon as it can, without posting multiple times in the day. Also, if it fails to post, it will retry later.
This project was developed to tweet random messages daily for the Boris The BabyBot account.
Though, this project could be configured easily to tweet for any Twitter account that you have access to, whether your personal account or a dedicated bot account.
To access the Twitter API, you must apply for a Twitter developer account - that takes time and effort.
You can copy the API credentials from your dev account to this project's local config on machine. See setup instructions in Documentation for more details.
If you are interested in how this project works, see the boris/lib/twitter.py module. That includes functions to connect and post to the Twitter API. It also combines the configured messages, emojis and hashtags randomly to generate a status.
You are allowed by Twitter to make a bot account, but one that follows Twitter's restrictions.
I cover this in more details in the Bots section of my Python Twitter Guide project.
Released under MIT.