A Python bot designed to create original tweets from the most recent @realdonaldtrump tweets.
The @trumpatron1 Twitter account is a mock account ran by this bot. At a regular interval, this bot runs, fetches the most recent @realdonaldtrump tweets, and mixes statements from those tweets together to create a new, original Tweet.
After being generated, it's tweeted to the @trumpatron1 account.
- Debian 6+
- Ubuntu 14.04+
- CentOS 6+
- python 3.3+
- pip3
- setuptools (if installing libraries)
To install TrumpaTron locally, follow these steps:
- Download and unzip the latest stable release from GitHub:
bot@trumpatron1:~$ wget https://github.com/magneticstain/TrumpaTron/archive/master.zip
bot@trumpatron1:~$ unzip master.zip
- Install application requirements:
bot@trumpatron1:~/TrumpaTron-master$ pip3 install -r requirements.txt
- (Opt.) If you plan on utilizing the trumpatron library in your own applications (i.e. want to import the libraries in your own python scripts),
run the
setup.py
file now:
bot@trumpatron1:~/TrumpaTron-master$ sudo ./setup.py install
- Move files to a static directory:
bot@trumpatron1:~/TrumpaTron-master$ sudo mkdir /opt/trumpatron && sudo cp -rf ./* /opt/trumpatron/
- Create log directory:
sysadmin@nyc3ttrontesting01:/opt/trumpatron$ sudo mkdir /var/log/trumpatron/
TrumpaTron is now installed and ready to use.
Nothing is easier than running this application. It's the greatest syntax ever, believe me!
sysadmin@nyc3ttrontesting01:~/TrumpaTron-master$ /opt/trumpatron/trumpatron.py -h
usage: trumpatron.py [-h] [-f LOG_FILE] [-l LOG_LEVEL] [-c CONFIG_FILE]
[-n NUM_CLAUSES] [-y] [-k] [-t] [-d] [-s SLEEP_DELAY]
[-r]
A Python bot designed to create original tweets from the most recent
@realdonaldtrump tweets.
optional arguments:
-h, --help show this help message and exit
-f LOG_FILE, --log-file LOG_FILE
File to write application logs to
-l LOG_LEVEL, --log-level LOG_LEVEL
Minimum log severity level to log to file
-c CONFIG_FILE, --config-file CONFIG_FILE
Configuration file to be used
-n NUM_CLAUSES, --num-clauses NUM_CLAUSES
Number of clauses to use in Tweet
-y, --assume-yes Assume YES for all prompts
-k, --config-check Try running TrumpaTron up to after the configs are
read in
-t, --test-run Run TrumpaTron in test mode (generate tweet w/o
publishing)
-d, --daemon-mode Run TrumpaTron in daemon mode (run persistently)
-s SLEEP_DELAY, --sleep-delay SLEEP_DELAY
Time to wait in between runs (used w/ -d|--daemon-
mode)
-r, --random-sleep Sleep for a random delay, with the value for
-s|--sleep-delay being the max sleep time
Perform a configuration check on the primary config:
bot@trumpatron1:/opt/trumpatron$ ./trumpatron.py -c conf/primary.cfg -k
Perform a test run using the default config:
bot@trumpatron1:/opt/trumpatron$ ./trumpatron.py -t
Use tertiary config file:
bot@trumpatron1:/opt/trumpatron$ ./trumpatron.py -c conf/tertiary.cfg
Assume yes to all prompts using the default settings (automated tweeting):
bot@trumpatron1:/opt/trumpatron$ ./trumpatron.py -y
Use the settings in conf/secondary.cfg
, generate a tweet with three clauses, and assume yes for all prompts:
bot@trumpatron1:/opt/trumpatron$ ./trumpatron.py -c conf/secondary.cfg -n 3 -y
Run trumpatron.py in test daemon mode using specific config and log file/level:
bot@trumpatron1:/opt/trumpatron$ ./trumpatron.py -c /opt/trumpatron/conf/specific.cfg -d -t -f /home/testing/ttron_test.log -l DEBUG
Run trumpatron.py in test daemon mode, ensuring any log messages WARN level and above are written, and overriding config values for number of clauses and sleep delay (30s):
bot@trumpatron1:/opt/trumpatron$ ./trumpatron.py -c /opt/trumpatron/conf/specific.cfg -n 3 -d -t -s 30 -l WARN
Run trumpatron.py in daemon mode using specific config file, with random sleep delay (max 120s):
bot@trumpatron1:/opt/trumpatron$ ./trumpatron.py -c /opt/trumpatron/conf/specific.cfg -d -s 120 -r
A configuration file is used by the application for various settings, mostly related to Twitter API authentication.
It's located at conf/main.cfg
. Open the file to take a look at the various settings and customize them to your liking.