Small java app that publishes a randomly selected image to twitter<
- scan a given directory (and recursive all subdirectories) for image files and select one random image
- post this image to twitter, uses file name as posted text
- up to four images per tweet
- some sort of intelligent text replacement (from "1991-10" in the filename it makes "10/1991" in the twitter post)
- create empty marker file for used image (ends with ".used.real"), so this image will not be used again until you delete this marker file
- optional: simulation mode to check what the app would do
- (clone repository)
- copy src/main/resources/twitter4j.properties.tpl to src/main/resources/twitter4j.properties and enter your twitter oauth things (get them here: https://developer.twitter.com/en/docs/authentication/oauth-1-0a/obtaining-user-access-tokens )
- run "mvn install"
- get the jar from the installation folder and copy it e.g. to app.jar
- for simulation mode run:
java -jar app.jar [image directory]
- for real mode run:
java -jar app.jar [image directory] doit
If you want to use more than one image in a tweet (e.g. if you have multiple files/pages for one thing) name them (up to four) like this:
- myfile__1.jpg
- myfile__2.jpg
- myfile__3.jpg
- myfile__4.jpg
I use docker to run the application:
docker run -i --rm --name jdk17 -v /var/www/twitter-picture-bot:/twitter-picture-bot openjdk:17.0.2-oraclelinux8 java -jar /twitter-picture-bot/app.jar /twitter-picture-bot/images doit
This software was developed for usage at the KultpowerBot