My Twitter Bot

by Anna on March 25, 2013, no comments

I teach computer programming to children using Scratch and I am often thinking of new lesson ideas or fun things I can make in Scratch. I made a quick “game” where a parrot repeats what you type but mixes up the vowels. For example, if you typed in “hello my name is anna” it may write back “hilla mo nomu as innu.” The kids in my class thought it was really funny to read the new scrambled sentences, and so did I.

Around the same time, I was reading about twitter bots and decided to see if I could make one based on my Scratch game. I knew I could do the actual coding part in python, but I didn’t know much about cron jobs or apis or hosting python scripts.

I found a very helpful step by step guide┬áthat served as a great starting point,┬ábut I couldn’t use my website to host the script. So I got a Digital Ocean account, which turned out to be a great learning experience! I had to figure out how to connect to my server using SSH, edit a crontab and use separate virtual environment for each project.

Now my little twitter bot checks for new mentions every 10 minutes and replies with scrambled sentences to anyone who mentions it. The code is here.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>