Create a Twitter warbot that automatically tweets the state of a battle royale game. It randomly selects 2 participants from a list to fight each other: one wins, the other one dies. The last contender standing is the winner. The updates are periodically published on Twitter (including an image) until the game finishes.
A Twitter developer account is needed to use this bot. Once the account is created, you'll see 4 codes in the 'Keys and tokens' section of your app. Place these codes in a file to allow the Java application the access of your account. You can find an example here. This file can be placed wherever you want as long as it's referenced in the Authentication class constructor. The default path of this file is config/tokens.env
.
Next, select a directory where all the content of the battle royale game will be stored. In the example from this repository, everything is inside the example_battlefield
folder. The folder must contain a list of participants, one per line, as you can see here. If a line starts with #
, this person is no longer in the game, since other player has killed it.
Create a main class similar to the provided in the demo. It's highly recommended to schedule the tweets using a tool such as ScheduledExecutorService
.
If everything went OK, the tweets should look like this:
This project is licensed under the MIT License - see the LICENSE file for details