||10 months ago|
|config||10 months ago|
|data||10 months ago|
|lib||10 months ago|
|.gitignore||10 months ago|
|Dockerfile||10 months ago|
|Pipfile||10 months ago|
|README.md||10 months ago|
|docker-compose.yml||10 months ago|
|rename_media_files.py||10 months ago|
|twitter_bot.py||10 months ago|
Twitter Bot @firstname.lastname@example.org
I made this for @email@example.com to post things every day for them.
You will need Python3 and the
pipenv package. Optionally, you can install
docker-compose and follow the docker instructions.
In order to install the necessary
python packages needed for the bot, run a
pipenv install as usual.
Docker / docker-compose
You should be able to build the container with a single
docker-compose up --build --no-start
Additionally, you may need to set the permissions for the
data/ directory to write for guest in order to allow the container to write to a
.tmp_counter file used to keep track of which file to upload.
sudo chmod 777 -R data/
NOTE: Be very careful with doing this, it may be safer to simply
sudo chown 991:991 -R data/ instead in order to keep an entire directory from being able to be written to by any system user. However, this comes with the downside of needing to
sudo cp every file you want to have uploaded in
In order to run the bot, you will need to copy the
config.json and fill the required fields:
* These can be found by creating an app at https://developer.twitter.com.
valid_file_formats is used to help the bot filter out what kinds of file formats you are attempting to upload. I don't recommend changing this much, as there are only so many file formats officially supported by Twitter in the first place.
timezone should follow your preferred timzone for when you want the bot to post each day, and
post_time should be in 24-hour time format an integer representing the time each day you want to post, for example:
1530 would have the bot post at 3:30 PM.
You should be able to start the bot by issuing the following command:
pipenv run python twitter_bot.py
Docker / docker-compose
You should be able to start the container by issuing the following command:
This bot will take whatever is in the
data/ directory that is a valid media file format and upload one media file to Twitter on the authenticated user account each day at a certain time, iterating through each item.
Once the bot finishes iterating through the available files, it will loop back to the beginning.
If you have any questions or need help setting up (or want to report a bug), you can contact me in the following places most effectively: