First ever Twitterbot for Henry Projects--keeping it simple
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.idea
Include
Lib
Scripts
__pycache__
tcl
venv
README.md
bard_credentials.py
freshness.py
insult_generator.py
pip-selfcheck.json
requirements.txt
twitterBot.py

README.md

ProtoTwitterBot

First ever Twitterbot for Henry Projects--keeping it simple!


Dependencies:

  • tweepy

Build history:

  1. The first build simply posted a random insult to its own wall, directing it @realdonaldtrump. This was the minimum viable product, and it was mainly so we could get something up and running on Heroku.

  2. The second build used a very simple (1 column, 1 row) SQLite database to store the ID of Trump's last post. When it scraped, it would check the ID of the newest post against the one stored in the db, then if the newest post was different, it would reply to that with a random insult. Finally, it would replace the contents of the db with the ID of Trump's new post. If the scraped post was not new, it would go back to sleep.

  3. For the third build, we discovered that Heroku does not play nicely with SQLite (who knew?), and our db was getting wiped at least once every 24 hours. Our first inclination was to use PostgreSQL to store our 1-column, 1-row db, but this was a little overkill. Our second idea was to use the pickle library to create a small text file containing just the ID of the last post that Bard had replied to. The final, and more elegant, solution, was to simply do two scrapes: one to determine the ID of Bard's last post, and one to determine the ID of Trump's last post. If Trump's last post is newer than Bard's, then Bard replies to it.